I want to generate apk in vs code by command flutter build apk
, So :
- I install Android Studio and Android SDK in path
C:Android_SDK
. - I execute command
flutter config --android-sdk "c:Android_SDK"
in vscode terminal - I Restart vscode.
- I defined enviroment variable
ANDROID_HOME
with valueC:Android_SDK
. - I execute command
flutter build apk
in terminal.
but returns this error :
Checking the license for package Android SDK Platform 33 in
c:Android_SDKlicenses License for package Android SDK Platform 33
accepted. Preparing "Install Android SDK Platform 33 (revision 3)".
"Install Android SDK Platform 33 (revision 3)" ready. Installing
Android SDK Platform 33 in c:Android_SDKplatformsandroid-33
"Install Android SDK Platform 33 (revision 3)" complete. "Install
Android SDK Platform 33 (revision 3)" finished. Font asset
"MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184
to 2356 bytes (99.9% reduction). Tree-shaking can be disabled by
providing the –no-tree-shake-icons flag when building your app.
ERROR: Missing classes detected while running R8. Please add the
missing classes or apply additional keep rules that are generated in
D:ProjectszTempMehChat_Frontendbuildappoutputsmappingreleasemissing_rules.txt.
ERROR: R8: Missing class
com.google.errorprone.annotations.CanIgnoreReturnValue (referenced
from: com.google.crypto.tink.KeysetManager
com.google.crypto.tink.KeysetManager.add(com.google.crypto.tink.KeyTemplate)
and 52 other contexts) Missing class
com.google.errorprone.annotations.CheckReturnValue (referenced from:
com.google.crypto.tink.InsecureSecretKeyAccess and 1 other context)
Missing class com.google.errorprone.annotations.Immutable (referenced
from: com.google.crypto.tink.InsecureSecretKeyAccess and 40 other
contexts) Missing class
com.google.errorprone.annotations.RestrictedApi (referenced from:
com.google.crypto.tink.aead.AesEaxKey$Builder
com.google.crypto.tink.aead.AesEaxKey.builder() and 6 other contexts)
Missing class javax.annotation.Nullable (referenced from:
java.lang.Object
com.google.crypto.tink.PrimitiveSet$Entry.fullPrimitive and 86 other
contexts)Compilation failed to complete
- 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 16m 19s Running Gradle task ‘assembleRelease’…
981.2s Gradle task assembleRelease failed with exit code 1
There is solution for this problem?
2
Answers
Just type this in your terminal:
For example:
Let me know if your problem solved or not
Happy Coding 🙂
You can install android studio,
Then it will ask for sdk path folder, since you don’t have any, selected an empty folder and click on next.
Android studio will download sdk for you.
Remember to use VPN or shekan(IP changer) if you are located in Iran