28

I am trying to set up flutter with VS Code in Ubuntu. I have followed the installation guide and have installed the latest cmdline tools as required by the flutter doctor.

Now this is the output I get on running flutter doctor again

    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details. 

On running flutter doctor --android-licenses I get the following error

java.lang.UnsupportedClassVersionError: 
com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled 
by a more recent version of the Java Runtime (class file version 61.0), 
this version of the Java Runtime only recognizes class file versions up to 55.0

I tried upgrading to Java 17 using sudo apt install openjdk-17-jdk and set up the environment variables but the problem still persists.

1
  • Did you find a working solution for this problem? I am facing the same issue now.
    – Anjaan
    Commented Sep 8, 2023 at 3:21

7 Answers 7

52

I was able to resolve this issue on Windows 10 with these steps

Install Android SDK Command-line Tools 8.0

  1. Using the Android Studio SDK manager, install Android SDK Command-line Tools 8.0. You may need to toggle the checkboxes highlighted in green to see the older versions like 8.0.
  2. Using windows explorer, navigate to the Sdk/cmdline-tools folder. On my system it's located at C:\Users\<USER_NAME>\AppData\Local\Android\Sdk\cmdline-tools.
  3. Rename the 8.0 folder to latest
  4. Run flutter doctor --android-licenses.
8
  • Thank you so much for this answer! It worked perfectly and solved my issue. You're a lifesaver! What I was missing was to select the 'show package details' otherwise the older version 8.0 was not visible.
    – gojiraki
    Commented Aug 20, 2023 at 17:54
  • same trick worked on macOS too, with the difference that the cmd line tools directory will be probably at ~/Library/Android/sdk/cmdline-tools
    – marcinP
    Commented Aug 22, 2023 at 17:11
  • 1
    You're a lifesaver, worked with me on windows 11 with version 10.0, latest version at the time of my comment is 11.0
    – Ramzy
    Commented Aug 29, 2023 at 12:09
  • finally found that is working for me. Thanks. Now the last problem is: Unable to find bundled Java version Commented Sep 10, 2023 at 16:47
  • 1
    Thank you, you are a rockstar. I did not even rename the 8.0 folder just deleted the latest folder, and it still worked. Commented Nov 19, 2023 at 15:58
17

Try this (for Mac)...

  • Check Android SDK command-line Tools (latest)
  • Check Android SDK command-line Tools 8.0
  • Click Apply
  • In Mac, go to /Users/Library/Android/sdk/cmdline-tools and rename the 8.0 folder to latest.
  • Run Flutter doctor again.
5
  • 1
    crazy, but it works
    – desmeit
    Commented Oct 16, 2023 at 12:00
  • This worked for me! Question: after running flutter doctor, do I restore the folder names? Or just leave it (8.0 ==> latest). Commented Oct 30, 2023 at 16:56
  • This saved us from our blockage for weeks.
    – Adi
    Commented Dec 13, 2023 at 10:56
  • Also works with Unity 2022.3.19f1, when using custom Java/Android build tools Commented Feb 15 at 12:07
  • The location is a bit different for me its /Users/(my username)/Library...
    – Bani Akram
    Commented May 6 at 6:54
6

Try This (For Windows) ...

  • Uncheck Android SDK command-line Tools (latest)
  • Check Android SDK command-line Tools 8.0
  • Click Apply
  • In Windows, go to “C:\Users\USERNAME\AppData\Local\Android\Sdk\cmdline-tools” and rename the 8.0 folder to “latest”

Run Flutter doctor again.

1
  • Thanks. This is working. I only do the first three step and no need to rename the 8.0 folder.
    – Rivalus
    Commented Oct 18, 2023 at 23:34
2

I had the same problem and fix it by removing the version installed (openjdk-11-jre and openjdk-11-jdk) and installing the newest one (openjdk-19-jre and openjdk-19-jdk).

-1

I had the exact same problem but on Windows. I solved it by completely uninstalling JDK, which searching on internet turned out to be a possible problem, and installing the latest version (20).

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 15, 2023 at 13:51
-1

Apart from installing android sdk command line tool, I also have to upgrade my android studio to the latest to fix it.

-2

Just update your platform tools, and command-line, and it should work

2
  • As far as I can tell, what you are suggesting is already explained in the other answers and in greater detail. Am I missing something?
    – Abra
    Commented Mar 5 at 7:39
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 6 at 2:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.