Android License problem

490 views
Skip to first unread message

Richard Lamb

unread,
May 26, 2021, 7:11:05 PM5/26/21
to Flutter Development (flutter-dev)
I'm new to Flutter development.  When running the flutter doctor (see output below), I got a message to run flutter doctor again to accept licenses.  However when I run it again (see output below), I get a Java error message.

Anyone have a clue how to remedy this?

Thanks,
Rich


Output from flutter doctor commands:

C:\src\flutter\bin>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version
    10.0.19043.985], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)

    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.

      more details.
[√] Chrome - develop for the web
[!] Android Studio (not installed)
[√] Connected device (2 available)

! Doctor found issues in 2 categories.

C:\src\flutter\bin>flutter doctor --android-licenses
Error: Could not find or load main class Files
Caused by: java.lang.ClassNotFoundException: Files

C:\src\flutter\bin>

Benedicte Roussel

unread,
May 26, 2021, 7:52:52 PM5/26/21
to Flutter Development (flutter-dev), Richard Lamb
Hi Richard,

you have the answer in your message:

  Run `flutter doctor --android-licenses` to accept the SDK licenses and then follow the instructions which should be 'yes' at each licenses missing

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/ffea0f12-2aa6-42a8-bfe2-f92da7faf8e3n%40googlegroups.com.

Richard Lamb

unread,
May 26, 2021, 10:20:10 PM5/26/21
to Flutter Development (flutter-dev)
Hi Bened,
Thanks for the quick reply.  I did try 'flutter doctor --android-licenses'.  That resulted in the Java error,  shown at the bottom of my message.
I've replicated that below:

C:\src\flutter\bin>flutter doctor --android-licenses
Error: Could not find or load main class Files
Caused by: java.lang.ClassNotFoundException: Files

Best,
Rich


Konrad Neitzel

unread,
May 27, 2021, 12:05:35 AM5/27/21
to Flutter Development (flutter-dev), Richard Lamb
That seems to be a sdkmanager problem (and not a flutter problem).

Go to the android sdk location and try to run sdkmanager manually (from inside tools\bin).

You need to call sdkmanager —licenses to accept all licenses (and I think flutter doctor is not doing anything else).

Kind regards,

Konrad

Richard Lamb

unread,
May 27, 2021, 12:32:41 AM5/27/21
to Flutter Development (flutter-dev)
Thanks.  Still no success, but getting closer.  sdkmanager.exe was in the folder:
c:\program files (x86)\android\android-sdk\cmdline-tools\latest\bin 

I got the same Java error when running sdkmanager -licenses

So, at least I know the program that is causing the error (I think).

Best,
Rich


On Wednesday, May 26, 2021 at 4:52:52 PM UTC-7 Bened wrote:

Rajil VEMBE

unread,
May 27, 2021, 2:25:12 AM5/27/21
to Richard Lamb, Flutter Development (flutter-dev)
install again sdk  dart ans flirter
See if path are well config (Android path and ...)
Repeat again

--

Konrad Neitzel

unread,
May 27, 2021, 2:36:30 AM5/27/21
to Richard Lamb, Flutter Development (flutter-dev)
I would simply check if there is a valid Java installation on the path. (e.g. call java -version)

One try to fix this could be to get an Java 8 (e.g. from https://adoptopenjdk.net/, feel free to get the zip file and then set JAVA_HOME and PATH so that it is used if you do not want to install it fully through an MSI - so if you unzip it to c:\Apps\openjdk-8 then you need:
SET JAVA_HOME=c:\Apps\openjdk-8
SET PATH=%JAVA_HOME%\bin;%PATH%
I just hope that I have no typing mistake - have no windows system to test it right now.)
Once you get a good response of java 8 with a java -version, you should try the sdkmanager call again.

From my perspective it is not a problem with the flutter files and i even doubt that the core android sdk installation has a problem. it seems to be a problem with Java.

Kind regards,

Konrad


Benedicte Roussel

unread,
May 27, 2021, 5:04:42 PM5/27/21
to Konrad Neitzel, Richard Lamb, Flutter Development (flutter-dev)
Hi Richard,
Do you have in your SDK tools the Android sdk build tools 31 rc 4 fully installed and in your SDK Platforms Android S Preview fully installed? Check also in SDK tools if anything else needs to be loaded as plain updates do not necessarily download things along.


Le jeu., mai 27, 2021 à 8:36, Konrad Neitzel
<kon...@kneitzel.de> a écrit :
--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsub...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/21ACCB1E-3202-48EA-8BC2-7E4BCACD5AE3%40kneitzel.de.

Richard Lamb

unread,
May 27, 2021, 8:05:01 PM5/27/21
to Benedicte Roussel, Konrad Neitzel, Flutter Development (flutter-dev)
Alright!  I finally got the problem resolved.  The solution was uninstalling Android Studio, Android-SDK, and Java (version 16).  I then made sure that there were no remaining "bits" to any of those applications in the Program Files and Program Files (x86) folders.  Then, I reinstalled Android Studio, Android-SDK, and Java 8 SE (from Oracle site).  For some reason, I had to install the Android-SDK in a non-standard folder (it did not  want to install in Program Files (x86)).  So, I ran flutter doctor to assert the path to the SDK.  After that, everything just seems to be working.  
In the end, I think the problem may have been the installation of Java 16 (the latest), but I decided to start over from a (mostly) clean slate (I kept the install of Flutter).

Thanks for all of the help on this.  I am comforted by the quick community support I received.

Best to all of you!

Rich
 

Rajil VEMBE

unread,
May 27, 2021, 10:07:29 PM5/27/21
to Richard Lamb, Benedicte Roussel, Konrad Neitzel, Flutter Development (flutter-dev)
Nice enjoy your code !

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CAPVqOC6C21snedY%2BMT%3Dm__vFGAtG-1janM1Fj6HtBLusM0n%3DFA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages