'Android sdkmanager tool found, but failed to run' for flutter doctor --android-licenses
Asked Answered
G

9

17

I've been trying to setup flutter with android studio on my laptop (Windows 11), and as I tried to agree to the android licenses the below error occured : enter image description here

The first error in red says

'(C:\Users\jerry\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat): "ProcessException: Cannot find file specified'

Apologies for the Japanese.

Below are the SDK Platforms installed : enter image description here

Solutions attempted :

enter image description here

  • Reinstalling Android studio
  • Updating the sdkmanager enter image description here
  • Checking PATH variables (JAVA_HOME in the System Variables set to C:\Program Files\Java\jdk1.8.0_351)
  • Running the command myself, which has allowed me to agree to the licenses, however the issue persists with the android licenses when flutter doctor is run. Running the exact command

I've tried my best at scouring the internet for solutions, but any help would be much appreciated. I have made another question for the

" 'git rev-parse HEAD' is not recognized as an internal or external command"

error here : " 'git rev-parse HEAD ' is not recognized" error when flutter doctor, but still works normally? I'm not sure if the two issues are connected, but if someone can also assist me on that issue I'd be extremely grateful.

Gastritis answered 13/1, 2023 at 0:44 Comment(0)
B
23

It happen to me just now on my mac, after updating all sdk manager item to the latest version. Then, I downgrade the latest (version 11) Android SDK Commmad-Line Tools to version 10.

And it solve my problem.

SDK Manager - SDK Tools

Brachylogy answered 2/8, 2023 at 6:0 Comment(7)
How do you downgrade commandline-tools? I'm not getting any such option here in android studioManny
@Manny see my screenshot above, there is checkbox "Show Package Details". You need to checked it, then it will show all version availableBrachylogy
this is not the solution for me, i don't think its related anywayCleopatra
@Cleopatra either you can find the root cause, so it can be solved. Or, you can try a lot of possible solution to find one that match.Brachylogy
same to me, didn't work.Lyricism
this is the solution for me, btw: github.com/flutter/flutter/issues/…Lyricism
@GlennPosadas you can re-post it to a new answer along with reference. Hope some one will be find it.Brachylogy
M
13

I also stumbled to this problem when i upgrade Android Studio Electric Eel | 2022.1.1 Patch 1 to Android Studio Electric Eel | 2022.1.1 Patch 2.

The old java_home is

C:\Program Files\Android\Android Studio\jre

The new java_home is

C:\Program Files\Android\Android Studio\jbr

After setting correct environment variable flutter doctor setup license run smothly. Hopefully it can help.

Mckown answered 3/3, 2023 at 14:58 Comment(0)
D
6

i have the same exact problem when running flutter doctor --android-licenses i solved it by re-set my android studio path for flutter with flutter config --android-studio-dir=<android_studio_instalation_dir>, in your case it would be

flutter config --android-studio-dir="C:\Users\jerry\AppData\Local\Android"

and then just run flutter doctor --android-licenses again, hope its solved

by the way i'm using latest Android SDK Command-line tools (11.0)

Djerba answered 20/9, 2023 at 2:52 Comment(1)
do not do this if you don't know what you doing, this is dangerous answerCleopatra
P
0

Don't forget to at least restart your terminal after setting JAVA_HOME.

Preordain answered 2/4, 2023 at 20:43 Comment(1)
It's enough to restart Windows Terminal and Android Studio.Exception
R
0

In my case after downgrading my commandline-tools, I still have the same issue. What solved mine, Navigate to C:\Users\username\AppData\Local\Android\Sdk\cmdline-tools then delete/remove all other commandline-tools except folder 10, then run flutter doctor --android-licenses. I hope this work for you to. Thanks.

Raid answered 6/9, 2023 at 16:20 Comment(1)
this sounds like your specific issue, android studio should've managed this automatically, mine only 10 after downgradingCleopatra
P
0

Solution for macOS go to;

/Applications/Android Studio.app/Contents

copy & paste jbr file

change the file name of "jbr copy" to "jre"

run flutter doctor problem solved

Pathfinder answered 21/1 at 20:33 Comment(0)
B
0

Please try to

  • install command line tools (latest)
  • install Google Play licensing library

In the SDK Tools tab open the terminal and enter the command:

flutter doctor --android-licenses

and if necessary run:

flutter config --android-studio-dir="C:\Program Files\Android\Android Studio\bin"

then run flutter doctor --android-licenses.

Accept the license when it prompts.

Baltoslavic answered 11/2 at 0:58 Comment(0)
H
-1

Flutter doctor was posing the same licensing issue on Windows 10, even after I took the nifty cue here to manually run "sdkmanager.bat --licenses". The issue resolved when I set the recommended environment variables from SDK tools documentation. Flutter doctor reported some licenses were not accepted, but running "flutter doctor --android-licenses" took care of it.

Caveat, somewhat related: flutter doctor still chokes for two other issues:

✗ android-studio-dir = C:\Users\User\AppData\Local\Android\Sdk ✗ Unable to find bundled Java version.

The workaround typically offered for this issue has been to copy the contents of C:\Program Files\Android\Android Studio\jbr into the C:\Program Files\Android\Android Studio\jre directory; alternatively to update the JAVA_HOME environment variable path to the jbr directory. This didn't work this time. I had to take the suggestion flutter doctor offered:

Consider removing your android-studio-dir setting by running: flutter config --android-studio-dir=

Hope I don't need that, but flutter doctor thereafter reported favorably "No issues found!" All green checks. Finally.

Hjerpe answered 25/6, 2023 at 7:31 Comment(0)
P
-2

you need to check if your SDK version is old. In my case I had the same problem, and I fixed it by replacing the sdk version with the latest version. Greetings

Punctate answered 23/7, 2023 at 0:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.