- Flutter Doctor —android-licenses : Exception in thread «main» java.lang.NoClassDefFoundError [duplicate]
- 3 Answers 3
- Accepting Android SDK licenses by running flutter doctor —android-licenses crashes #66907
- Comments
- Andrewngabriel commented Sep 29, 2020
- darshankawar commented Sep 30, 2020
- liudonghua123 commented Oct 4, 2020
- liudonghua123 commented Oct 4, 2020
- pedromassangocode commented Oct 28, 2020
- shlovee commented Nov 19, 2020 •
- flutter doctor —android-licenses throws #57017
- Comments
- prujohn commented May 12, 2020
- Steps to Reproduce
- iapicca commented May 13, 2020
- azzazkhan commented Jul 3, 2020
- ev-harsh commented Sep 22, 2020
- Aminakazim commented Oct 16, 2020
- chinmoyrp commented Oct 17, 2020
- PranavViswanathan commented Oct 19, 2020
- harrymaurya05 commented Oct 22, 2020
- fin-k commented Oct 24, 2020
- Anuj1224 commented Dec 19, 2020
- swarup13 commented Dec 24, 2020
- dungvuquoc commented Jan 2, 2021
- flutter doctor —android-licenses may crash if findJavaBinary selects JAVA_HOME instead of AS Java #57372
- Comments
- KoyyalamudiHarsha commented May 16, 2020 •
- AndrewH2O commented May 16, 2020
- jonahwilliams commented May 17, 2020
- jonahwilliams commented May 17, 2020
- AndrewH2O commented May 17, 2020 •
Flutter Doctor —android-licenses : Exception in thread «main» java.lang.NoClassDefFoundError [duplicate]
I’m trying to install flutter but it won’t let me accept the android license. I get the following error:
I’ve already uninstalled my current version of Java and clean installed Java 8 from here.
This is what flutter doctor returns:
3 Answers 3
Installing Android SDK Command-line tools from Android SDK Manager did the job for me.
- Open Android Studio
- Tools > SDK Manager
- From the left choose, Appearance & Behavior > System Settings > Android SDK
- Select SDK Tools from the top menu
- Check Android SDK Command-line tools and click ‘apply’.
Firstly check for your JAVA_HOME path under System Variables it should be like —>
C:\Program Files\Java\jdk-15.0.2
(no semi-colon and no \bin)
and add to path (in System Variables)—> %JAVA_HOME%\bin
if still, you are getting any error try this in Android Studio—> Setting(Appearance & Behavior) -> Android SDK -> check and download Android SDK Command-line tools.
restart terminal and try again with flutter doctor —android-licenses
Источник
Accepting Android SDK licenses by running flutter doctor —android-licenses crashes #66907
Comments
Andrewngabriel commented Sep 29, 2020
Running flutter doctor —android-licenses throws the following error message:
Environment:
- OS: Mac OS High Sierra
- Flutter channel: master
- Flutter version: 1.22.0-10.0.pre.406
- Dart: 2.11.0 (build 2.11.0-176.0.dev)
Steps to reproduce:
- Install Flutter v1.22.0-10.0.pre.406
- Run flutter doctor and ensure that there are Android SDK licenses that are not accepted.
- Run flutter doctor —android-licenses
The text was updated successfully, but these errors were encountered:
darshankawar commented Sep 30, 2020
@Andrewngabriel
Can you try this solution and see if it works for you?
Thanks.
liudonghua123 commented Oct 4, 2020
I have the same issue. The following is the console log.
liudonghua123 commented Oct 4, 2020
I can fix it via change the JAVA_HOME environment.
pedromassangocode commented Oct 28, 2020
Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don’t hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v .
All system setups can be slightly different, so it’s always better to open new issues and reference related issues.
shlovee commented Nov 19, 2020 •
Hello,
I also faced this issue but this note helped me to resolve the issue.
In short, JDK 1.8 needs to be installed if the advanced JDK version is being used.
— Java and Flutter Doctor output
C:\Users\sonpe>where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\jdk1.8.0_271\bin\java.exe
C:\Users\sonpe>flutter doctor -v
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.19041.630], locale en-IN)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d30 (7 weeks ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[!] Android toolchain — develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\sonpe\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\jdk1.8.0_271\bin\java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
! Some Android licenses not accepted. To resolve this, run: flutter doctor —android-licenses
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
At this point of time, I followed the link and then run the below command to accept licenses which resolved the issue.
C:\Users\sonpe>flutter doctor —android-licenses
Warning: File C:\Users\sonpe.android\re[============================= ] 75% Computing updates.
6 of 7 SDK package licenses not accepted. 100% Computing updates.
Review licenses that have not been accepted (y/N)? y
- Final output of flutter doctor
C:\Users\sonpe>flutter doctor -v
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.19041.630], locale en-IN)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d30 (7 weeks ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[√] Android toolchain — develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\sonpe\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\jdk1.8.0_271\bin\java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
• All Android licenses accepted.
[!] Connected device
! No devices available
Источник
flutter doctor —android-licenses throws #57017
Comments
prujohn commented May 12, 2020
Steps to Reproduce
Unsure how it came to this state. It doesn’t bother me too much because I primarily target the web platform, but just thought I’d share for visibility. Is it the OpenJDK I’m using perhaps?
The interesting part is the exception thrown when I run flutter doctor —android-licenses
Happy to provide any other information.
The text was updated successfully, but these errors were encountered:
iapicca commented May 13, 2020
Hi @prujohn
I see there’s an open issue addressing the case you described.
Please follow up on that issue,
I’m closing the current one as duplicate.
If you disagree please write in the comments
and I will reopen it.
Thank you
azzazkhan commented Jul 3, 2020
I was also tackling the same issue for an entire day. I searched on StackOverflow, GitHub, Medium and other sites to find the solution to this problem but the thing that worked for me was uninstalling Java JDK version 14 and reinstalling JDK version 8.
I don’t want anyone to go through the same issue so I’m posting the detailed solution that worked for me.
When I executed the flutter doctor command in my CMD, the doctor showed me these summaries.
I tried to run flutter doctor —android-licenses and sdkmanager —licenses to accept the license agreement but after executing both threw the same exception.
I also tried to revert back my Java installation but that created a total mess for me.
These are the Android Studio SDKs that I’ve installed. I’ve read in many articles and threads that API level 29 Android 10.0 (Q) must be installed so I downloaded it and the physical device I’ve connected to is running Android 9 (Pie) so I’ve downloaded that as well.
I’ve downloaded and installed these SDK tools.
After that, I’ve uninstalled my Java JDK version 14 installation and installed JDK version 8 and set the JAVA_HOME and PATH environmental variables and restarted my PC.
By doing so the flutter doctor showed these summaries.
After running flutter doctor —android-licenses it showed these summaries.
All these steps worked for me.
ev-harsh commented Sep 22, 2020
I’ve just downloaded and installed Android SDK Command-line tools from Android SDK Manager. That works for me.
Aminakazim commented Oct 16, 2020
Works fine after SDK Command-line tools installation.
chinmoyrp commented Oct 17, 2020
Just like @ev-harsh and @Aminakazim, installing Android SDK command-line tools worked for me as well. So try it before attempting a jdk reinstall.
PranavViswanathan commented Oct 19, 2020
So you need to uninstall the previously installed jdk?
harrymaurya05 commented Oct 22, 2020
Works fine after SDK Command-line tools installation.
Thank you
fin-k commented Oct 24, 2020
Installing SDK command-line tools works, thanks.
Anuj1224 commented Dec 19, 2020
Thanks, Worked Fine After Installing «Android SDK command-line tools»
swarup13 commented Dec 24, 2020
Works fine after SDK Command-line tools installation.
Thank you
But now showing android studio not installed
dungvuquoc commented Jan 2, 2021
I was also tackling the same issue for an entire day. I searched on StackOverflow, GitHub, Medium and other sites to find the solution to this problem but the thing that worked for me was uninstalling Java JDK version 14 and reinstalling JDK version 8.
I don’t want anyone to go through the same issue so I’m posting the detailed solution that worked for me.
When I executed the flutter doctor command in my CMD, the doctor showed me these summaries.
I tried to run flutter doctor —android-licenses and sdkmanager —licenses to accept the license agreement but after executing both threw the same exception.
I also tried to revert back my Java installation but that created a total mess for me.
These are the Android Studio SDKs that I’ve installed. I’ve read in many articles and threads that API level 29 Android 10.0 (Q) must be installed so I downloaded it and the physical device I’ve connected to is running Android 9 (Pie) so I’ve downloaded that as well.
I’ve downloaded and installed these SDK tools.
After that, I’ve uninstalled my Java JDK version 14 installation and installed JDK version 8 and set the JAVA_HOME and PATH environmental variables and restarted my PC.
By doing so the flutter doctor showed these summaries.
After running flutter doctor —android-licenses it showed these summaries.
All these steps worked for me.
Источник
flutter doctor —android-licenses may crash if findJavaBinary selects JAVA_HOME instead of AS Java #57372
Comments
KoyyalamudiHarsha commented May 16, 2020 •
The text was updated successfully, but these errors were encountered:
AndrewH2O commented May 16, 2020
This is because android uses jdk 8 and you have a later jdk in your env path (looks like Windows). I do work with java and don’t wan’t to downgrade my jdk. Android studio uses its own local version of jdk 8 so the problem doesn’t arise there. Cannot understand why flutter doctor doesn’t first check for that dependency. Difficulty here though is that the flutter installation instructions https://flutter.dev/docs/get-started/install/windows takes you down this route.
Temporary fix was to change my JAVA_HOME variable to C:\Program Files\Android\Android Studio\jre.
This allowed those licenses to be accepted.
Then reverted back to my original value for JAVA_HOME
As I am using Android studio for flutter development it seems to work regardless which makes sense.
As there are many many google results about this issue may be good idea to revisit the install process/instructions perhaps?
jonahwilliams commented May 17, 2020
What does flutter doctor -v say? We should be checking that the correct version of Java is installed?
jonahwilliams commented May 17, 2020
That is, even if the doctor check is invalid we should validate the version before calling android licenses.
AndrewH2O commented May 17, 2020 •
@jonahwilliams
with a working setup in android studio and JAVA_HOME C:\Program Files\Amazon Corretto\jdk11.0.6_10
flutter doctor -v
flutter doctor -v
Changing JAVA_HOME to android studios version of jre JAVA_HOME : C:\Program Files\Android\Android Studio\jre and re-running flutter doctor —android-licenses
flutter doctor -v
—— + ——
Both cases doctor looks at jre binary used by Android Studio before checking licenses, and then it appears the license validation is based not on that binary but what is on the env path JAVA_HOME.
Источник