Error Note - Android Studio
records configuration issues and solution when developing on Android Studio
Android license status unknown.
Happened on attempting to install Flutter on windows
on
flutter doctor
got notice
Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
on
flutter doctor --android-licenses
got error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
Solution
Install Android SDK Command-line Tools (latest)
Files->Setting->Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools -> Install Android SDK Command-line Tools (latest)
after intall,
flutter doctor --android-licenses
accept all the licenses then problem solved.
Loading Devices
There will be additional device panel for after install the Flutter plugin, and the original one will show "loading devices"
Unable to locate adb
Solution
reintall Android SDK Platform-Tools
Files->Setting->Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools -> Android SDK Platform-Tools
ANDROID_SDK_ROOT not set
Solution
set environment variable ANDROID_SDK_ROOT to the location of Android SDK, like:
C:\Users\UserName\AppData\Local\Android\Sdk
Tips
use AVD manager to stop the emulated device
Cannot resolve symbol 'GradleException'
running gradle task 'assembledebug'
is downloading resorces
Solution
wait it out. It resolved the next morning
Could not open cp_init remapped class cache
Could not initialize class org.codehaus.groovy.classgen.Verifier
happened after clean gradle cache
Solution
switch back to main.dart
Flutter Inspector: installing devtools
Try File > Invalid Caches / Restart
not work
Solution
wait it out, reboot
Activating Dart DevTools
When
runing main.dart on real device while it is already running on an emulated device
Plant(Black/White) Screen
When
run on real device
Solution
if Profile "main.dart" works fine, just need to wait
Failed to start monitoring
Waiting for another flutter command to release the startup lock
Solution
remove ./flutter/bin/cache/lockfile
Running "flutter pub get" in flutter_app takes forever
Solution
check if the version of your required package is in correct format
check pubspec.yaml for possible error (even there is no highlight)