Permanent fix
-------------
To fix this issue permanently, type in terminal
1) `flutter doctor`
This will give you summary like this
[![enter image description here][1]][1]
You need to fix all those red marks!!
Fixing android licenses
-----------------------
type `flutter doctor --android-licenses`
if you encounter this error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Try to install Android SDK command-line tools from Android Studio (Tools > SDK Manager)
1. Unfold Appearance & Behavior
2. Unfold System Settings
3. Click Android SDK
4. Click tab of SDK Tools
5. Check Android SDK Command-line Tools (latest)
6. Click Apply button
[![enter image description here][2]][2]
Then run once again
`flutter doctor --android-licenses`
Fixing Flutter plugin not installed
-----------------------------------
1. Check your Android Studio Version (For Mac go to ~/Library/Application Support/Google/AndroidStudio{Version}. In my case, the {Version} is 2020.3)
2. Then type
> `ln -s ~/Library/Application\
> Support/Google/AndroidStudio2020.3/plugins ~/Library/Application\
> Support/AndroidStudio2020.3`
This command just redirects flutter doctor to the different folder to find plugins (where they are now). This is called symbolic link
Fixing unable to find bundled Java version
------------------------------------------
This solution is for Mac User
1. Find your local Java version by typing `/usr/libexec/java_home -V`
2. Set Java_Home path by typing `/usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home`
3. Type all of these in terminal
> cd /Applications/Android\ Studio.app/Contents/jre
> ln -s ../jre jdk
> ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
4. Finally run `flutter doctor -v` to see all the details changes
Happy Ending
------------
After fixing all those issues, run
flutter clean
flutter run
to build release apk
flutter build apk --split-per-abi
[1]: https://i.stack.imgur.com/Fxmh8.png
[2]: https://i.stack.imgur.com/Iwcb7.png
Permanent fix
-------------
To fix this issue permanently, type in terminal
1) `flutter doctor`
This will give you summary like this
[![enter image description here][1]][1]
You need to fix all those red marks!!
Fixing android licenses
-----------------------
type `flutter doctor --android-licenses`
if you encounter this error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Try to install Android SDK command-line tools from Android Studio (Tools > SDK Manager)
1. Unfold Appearance & Behavior
2. Unfold System Settings
3. Click Android SDK
4. Click tab of SDK Tools
5. Check Android SDK Command-line Tools (latest)
6. Click Apply button
[![enter image description here][2]][2]
Then run once again
`flutter doctor --android-licenses`
Fixing Flutter plugin not installed
-----------------------------------
1. Check your Android Studio Version (For Mac go to ~/Library/Application Support/Google/AndroidStudio{Version}. In my case, the {Version} is 2020.3)
2. Then type
> `ln -s ~/Library/Application\
> Support/Google/AndroidStudio2020.3/plugins ~/Library/Application\
> Support/AndroidStudio2020.3`
This command just redirects flutter doctor to the different folder to find plugins (where they are now). This is called symbolic link
Fixing unable to find bundled Java version
------------------------------------------
This solution is for Mac User
1. Find your local Java version by typing `/usr/libexec/java_home -V`
2. Set Java_Home path by typing `/usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home`
3. Type all of these in terminal
> cd /Applications/Android\ Studio.app/Contents/jre
> ln -s ../jre jdk
> ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
4. Finally run `flutter doctor -v` to see all the details changes
Happy Ending
------------
After fixing all those issues, run
flutter clean
flutter run
to build release apk
flutter build apk --split-per-abi
[1]: https://i.stack.imgur.com/Fxmh8.png
[2]: https://i.stack.imgur.com/Iwcb7.png