Flutter Doctor, Android licenses status unknown - android-studio

Flutter doctor says that my android license status cannot be found.
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.19041.450], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit
https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
[√] VS Code (version 1.48.2)
[!] Connected device
! No devices available
I did try running flutter doctor --android-licenses
that returned me with the following error
flutter doctor --android-licenses
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:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
What am I missing here?

I had the same problem.
Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f4abaa0735 (7 days ago) • 2021-07-01 12:46:11 -0700
Engine • revision 241c87ad80
Tools • Dart 2.13.4
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale es-ES)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.57.1)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
I have achived the solution on the next way:
1.- Open a terminal window.
2.- Set the environemnt var JAVA_HOME to the path where the jdk 8 ist. in my case is:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
3.- Run the command: flutter doctor --android-licenses
Thesethree steps haven resolved my problem.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale es-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.57.1)
[✓] Connected device (1 available)
• No issues found!

Save the value of your JAVA_HOME environment variable, then remove the JAVA_HOME environment variable if it exists.
Save the value of your jdk path. Remove your jdk from your PATH.
With those changes made, the flutter doctor --android-licenses should work.
If applicable, restore your JAVA_HOME environment variable and jdk in your path.
If that doesn't work, uninstall Android Studio and XCode, download the latest copies and reinstall.
If you can't resolve the issue, look at this thread: https://github.com/flutter/flutter/issues/28230

Related

Android Studio does not find cocoapods in console

Somehow Android Studio does not find cocoapods, even though it is correctly installed in the system via brew install coocapods. The Android Studio console looks like it doesn't get the correct PATH.
Note: Starting Android Studio through a terminal / iTerm with
open /Applications/Android\ Studio.app
does mitigate the issue, Android Studio then somehow gets the right path. But im wondering how i can archieve the same result for a start directly from the application directory / spotlight-search? Why does Android Studio not resolve the right PATH?
Android Studio Version 2021.1.1, macOS
Console output after click on "Flutter doctor":
/Users/[...]/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale de-DE)
• Flutter version 2.8.1 at /Users/[...]/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/[...]/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
...
Starting a terminal in Android Studio or starting iTerm, output:
flutter doctor -v
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale de-DE)
• Flutter version 2.8.1 at /Users/[...]/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/[...]/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
...
Fixed in Android Studio Bumblebee 2021.1.1.1.21 Patch 1 for Mac.
I just installed the latest ANDROID STUDIO Bumblebee 2021.1.1.1.21 Patch 1 for Mac Intel. I loaded an older FLUTTER app into it and ran, (from the run arrow in the IDE), it against an iPhone 8 Simulator device. The CocoaPods error did NOT appear and the app launched in the Simulator device. It seems to me that this update has fixed that error.
#scrimau wrote the best description of this issue.
Here's some further info:
echo $PATH (using Android Studio's Terminal) produces different results depending on which of the two methods is used to start Android Studio.
The same directories appear in both echo $PATH results, but the directories are shuffled around.
It almost seems like the sequence of directories (as shown by echo $PATH) might have something to do with the different behaviors.
(Sorry: This should have been a comment. I can't find a way to change an answer to a comment. I'll be more careful next time.)
Android Studio Bumblebee 2021.1.1.1.21 Patch 1 seems to have fixed this issue. In the release notes there is a similar issue mentioned:
Issue #216364005: Env variables not sourced when launched from Mac OS X to Monterey Dock

Out of memory when running app with Emulator on Android studio?

I run my app on Emulator of Android Studio 4.1.1 with exception:
../../third_party/dart/runtime/vm/zone.cc: 94: error: Out of memory.
version=2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "windows_x64"
pid=19872, thread=13300, isolate_group=main(000001D8CE0F0B60), isolate=main(000001D8CE117730)
isolate_instructions=7ff70550f230, vm_instructions=7ff70550f240
pc 0x00007ff7056a00ec fp 0x0000005f752fdff0 Unknown symbol
-- End of DumpStackTrace
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.49.0)
[√] Connected device (1 available)
I can run my app with real device.

Flutter plugin not installed when using Android-Studio

Hi I am getting the following error.
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18362.1016], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.48.2)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
I have installed both plugins and everything in environment variable.
I installed Android studio in my custom path, this may be the issue. I have given the current android-studio path using flutter config command.
When I check the Installation path the plugin is not there(flutter and dart). It is installed in C:\Users\AppData\Roaming\Google\AndroidStudio4.1\ path.
So I set that path then shows another error that is, embedded java is not found.
Also I tried copying it to custom path. But no luck.
Thanks for your help
If you are doing everything on vs code having flutter and dart not installed on android studio should not be an issue. You only need android studio to connect to the emulator. I can run my flutter code with both plugins not installed.

Flutter doctor search location

Where does flutter doctor command look for Android Studio, Visual Studio Code etc. Mine is not detecting VSCode even if I have installed it.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.3)
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories
I don't use Intellij with flutter, so I can simply ignore that warning.
I'm on Manjaro i3 and tried installing both VSCode open source (from Arch Community Repository) and MS branded version (from Arch User Repository) though pacman.
You can add VS Code to your PATH,then it will be solved.
Launch VS Code.
Open the Command Palette (Ctrl+Shift+P) and type 'shell command' to find the Shell Command:
Install 'code' command in PATH command.

Flutter Finished with error: ProcessException: Permission denied

I want to run my frist app with flutter but I got the following error :
Launching lib/main.dart on Android SDK built for x86 64 in debug mode.
Initializing gradle.
Resolving dependencies.
Finished with error shown below:
ProcessException: Permission denied Command:
/home/abdoul-razak/Android/Sdk/build-tools/28.0.3/aapt dump xmltree
/home/abdoul-razak/Projects/akoybiz/build/app/outputs/apk/app.apk
AndroidManifest.xml
here is the result of flutter doctor:
abdoul-razak#Komche:~/Projects/akoybiz$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale fr_FR.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
✗ Android license status unknown.
[✓] Android Studio (version 3.0)
[✓] VS Code (version 1.30.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
after updating the sdk android here is the result of flutter doctor -v
abdoul-razak#Komche:~/Projects/akoybiz$ flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.0.0 at /home/abdoul-razak/flutter
• Framework revision 5391447fae (il y a 9 semaines), 2018-11-29 19:41:26
-0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /home/abdoul-razak/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/abdoul-razak/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.0)
• Android Studio at /opt/android-studio
• Flutter plugin version 23.2.1
• Dart plugin version 171.4424
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[✓] VS Code (version 1.30.2)
• VS Code at /usr/share/code
• Flutter extension version 2.22.2
[✓] Connected device (1 available)
• itel P31 • 45YP8LSO4T7HWCLZ • android-arm • Android 7.0 (API 24)
• No issues found!
The issue is related to your Android SDK licenses. Run the command
flutter doctor --android-licenses
Then press y until it acquires all permissions.
xattr -d com.apple.quarantine ./gradlew
By using this command it solves the issue. I don't know the exact reason but it worked for me.
I stumbled across the same exception. And something fixed it, but I do not know what exactly.
The exception says something different but I think it has something to do where flutter is installed. I reinstalled it again like suggested on their website and it worked...
cd ~/development
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
Edit: Make sure you use a local folder for your flutter project too.

Resources