I’m trying to program Flutter using VS Code and use the BlueStacks Android emulator, but I’m encountering constant errors. I was told to install Java 8, which I did, but then I got an error in the terminal asking me to install Java 11, so I did that too. However, now I’m getting the following error. I would like to know how to resolve this error and be able to debug my Flutter app on the Android emulator using VS Code.
ERROR:
Checking the license for package Android SDK Platform 33 in C:Program Fileslicenses
Warning: License for package Android SDK Platform 33 not accepted.
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
Failed to install the following Android SDK packages as some licences have not been accepted.
emulator Android Emulator
patcher;v4 SDK Patch Applier v4
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
platforms;android-33 Android SDK Platform 33
tools Android SDK Tools
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
All licenses can be accepted using the sdkmanager command line tool:
sdkmanager –licenses
Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle
Using Android SDK: C:Program Files
- Try:
Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 27s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
2
Answers
You need to install and accept all license. And Android SDK components, including Android SDK Platform 33, Android Emulator, SDK Patch Applier v4, and Android SDK Build-Tools 30.0.3.
Make sure that the environment is correct and then restart the vscode and run the program again.
Note: Please use the latest version of Flutter and other extensions and ensure that JDK, JAVA_HOME and other environments are correct.
There is a related setting
java.jdt.ls.androidSupport.enabled
in the settings.Specify whether to enable Android project importing. When set to auto, the Android support will be enabled in Visual Studio Code – Insiders. Note: Only works for Android Gradle Plugin 3.2.0 or higher. Defaults to auto.
Currently, only the function of reading codes is provided, and more functions are still waiting to be improved.