Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio installs without sdkmanager

I've been programming in Flutter using macOS 10.15.3, targeting iOS devices. Today I tried installing Android Studio also, to branch out. The installation went without errors, but in Library/Android/sdk/ there is no tools subdirectory, which is a problem because sdkmanager is supposed to be found within Library/Android/sdk/tools/bin.

I noticed this because running flutter doctor gave me:

    ✗ 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/setup/#android-setup for detailed instructions.

I tried reinstalling Android Studio (no difference). Other solutions posted online talk about the Java version, so I upgraded the JRE from 1.7 to 1.8 and tried reinstalling Android Studio (no difference), and then upgraded JDK to the latest (so now the Java version is 11.0.6) and tried installing Android Studio again (no difference). I also upgraded Flutter to v1.12.13+hotfix.8 during the above, but this error won't go away.

If I type flutter doctor --android-licenses then I get:

    Android sdkmanager tool not found (/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager).
    Try re-installing or updating your Android SDK,
    visit https://flutter.dev/setup/#android-setup for detailed instructions.

This is how I first noticed that I'm missing part of Android Studio.

I tried cheating by creating a tools/bin subdirectory myself and then copying sdkmanager from a plugin's Library/Android/sdk/cmdline-tools/latest/bin to my new Library/Android/sdk/tools/bin. However, this didn't fool Flutter. Running flutter doctor --android-licenses led to:

A newer version of the Android SDK is required. To update, run:
/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager --update

This is wrong because the Android SDK is the newest.

Does anyone know why Android Studio would be consistently missing the tools/bin subdirectory and the goodies inside? Thanks and sorry if I overlooked something basic.

like image 773
Mark Ebden Avatar asked Feb 28 '20 23:02

Mark Ebden


People also ask

How do I fix Sdkmanager not found?

To Solve Android sdkmanager tool not found in Flutter The right solution would be if you have android studio installed then the command flutter doctor and it should now prompt you to run flutter doctor –android-licenses, once you run the license command, accept all licenses by hitting Y and it should solve the problem.

Do I need to install Android SDK separately?

There's even an open Java Development Kit (JDK) included, so you no longer need to separately install the latest version separately. Installing Android Studio is just as simple and we have a guide to help you out here. Again, it is just a matter of downloading the installer and following the steps as prompted.

Can not find SDK manager in Android Studio?

Quick fix: Go to the Tools –> SDK manager –> SDK tools. Deselect Hide obsolete packages option on the right bottom and further install Android SDK Tools(obsolete). A new folder named Tools is now generated in the SDK directory.


3 Answers

Update 1 (2020-02-29)

Seems like latest version of Android SDK renamed the 'Android SDK tools' package into 'Android-SDK command line tools'. But unfortunately current stable version of the Flutter SDK (v1.12.13+hotfix.8) is not compatible with this change and it keeps showing error message.

image description

Workaround:

As @Mark Ebden suggested, You can simply Uncheck Hide Obsolete Packages checkbox on the SDK tools page and you'll see Android SDK Tools (Obsolete) 26.1.1. Install it and you are good to go. If you find anything missing, read the following detailed instructions.

See this issue on flutter repo for more info.


Here is the complete details you want while installing android studio with latest version of Mac OS.

1. Install Android Studio stable version.

2. Open android studio

3. open SDK manager. See the screen shot below.

enter image description here

4. Make sure you have downloaded all required stuff. See the screenshots below.

enter image description here

enter image description here

Please note that, I am using a custom location (/Users/darish/development/sdk/android) for my Android SDK instead of the default location (Library/Android/sdk/)

5. Go to your home directory and check whether there is a .bash_profile or not. If yes, open it, if no, create one. Add the following contents to that file.

 export PATH="$PATH:~/development/sdk/flutter/bin"
 export ANDROID_HOME="/Users/darish/development/sdk/android"
 export PATH="$PATH:$ANDROID_HOME/platform-tools"

6. Once all the above steps are done, run flutter doctor --android-licenses and accept all licenses.

flutter doctor --android-licenses

7. Now run flutter doctor to see everything ok. If you need any further assistance, let me know. :)

That's all, have a nice day :)

like image 185
Darish Avatar answered Oct 29 '22 19:10

Darish


What worked for me:

  1. Run flutter doctor --android-licenses -v
  2. I got a message that goes like:

$ flutter doctor --android-licenses -v Android sdkmanager tool not found (/Users/juarse1/Library/Android/sdk/tools/bin/sdkmanager). Try re-installing or updating your Android SDK, visit https://flutter.dev/setup/#android-setup for detailed instructions.

  throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
  AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:311:7)
  Doctor.diagnose (package:flutter_tools/src/doctor.dart:243:38)

This is because Android SDK is not finding command tools, but this needs to be forced to pull from obsolete package, so: 3. Go to Android Studio -> Preferences -> System Settings -> Android SDK -> SDK Tools Section 4. Uncheck Hide Obsolete Packages at the bottom 5. Make sure BOTH options are checked:

Android SDK Platform-Tools AND Android SDK Tools (Obsolete)

  1. OK, close Android Studio
  2. Run flutter doctor --android-licenses, should work!
like image 29
Sebastian Juarez Avatar answered Oct 29 '22 21:10

Sebastian Juarez


The problems seems to be that in java 11 ( or 9 and 10 ) the jaxb libs are not included in the JDK and android studio sdkmanager can't read the licenses xml files. You have to include this libs on the classpath (if you are using Java 11), you can follow the instructions posted here (it worked for me in Windows 10)

https://medium.com/@parsher/flutter-android-sdkmanager-update-with-jdk-12-ad8098165472

The last step is not necessary. After included the classpath lines, run de flutter doctor and everything should be all right.

like image 28
Miguel Angel Sequedo Garcia Avatar answered Oct 29 '22 20:10

Miguel Angel Sequedo Garcia