3

I wanted to start learning Flutter, so I'm following the guide, but I'm already stuck on the very first step. I haven't done anything other than create a brand new app, but when I hit "Run" in Android Studio I get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: /home/greg/Android/Sdk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Finished with error: Gradle task assembleDebug failed with exit code 1

Looking at people with similar problems, the most common solution seemed to be running yes | ~/Android/tools/bin/sdkmanager --licenses, but I don't have a folder or file called sdkmanager. My entire document tree is different actually, although I just went through the official Android Studio download process for Ubuntu. For my document structure, I have

~/Android/Sdk/$ ls
build-tools  patcher    platform-tools  sources
emulator     platforms  skins  

none of which contain tools, bin, or sdkmanager.

I also opened SDK Manager in Android Studio, and went to the SDK Tools tab and updated Build-Tools and accepted the license, then quit and reopened Android Studio, but I'm getting the same error. I can't find anyone with the same file structure as me. Anyone know what I can do?

EDIT

I'm starting to think the real issue is the contents of my Android folder. When I run flutter doctor I get this message

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ 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.
[!] Android Studio (version 3.6)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2019.3)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

But when I run flutter doctor --android-licences I get the following error message:

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

I don't in fact have a tools folder, or bin, or sdkmanager. I did try uninstalling and reinstalling Android Studio, but nothing changed. Did I download an incorrect package or something? I downloaded it directly from https://developer.android.com/studio/#downloads, so how is it possible that the contents seem to be incorrect? I have 100GB free, so space constraints didn't stop it from being installed. I don't have any internet issues either.

Joe Morano
  • 1,715
  • 10
  • 50
  • 114

5 Answers5

11

I'm facing the same issue too on MacOS.

I just downloaded the Android Studio today (android-studio-ide-192.6241897-mac) and the /tools folder is missing for me too.

The only way I can see an 'sdkmanager' inside the 'Android/' directory is when I install cmdline-tools and find it in the bin folder. but that doesn't solve the problem.

EDIT

Found the solution. Apparently, the 'tools/' folder doesn't exist in the latest Android Studion build.

You can still install the SDK tools using the SDK manager in the Android studio.

Open the SDK manager and go to the 'SDK Tools' tab. On the bottom uncheck the 'Hide Obsolete packages' checkbox.

After doing that an option to install the 'Android SDK Tools (obsolete)' package will appear.

Install them and run the flutter doctor again. And it works after accepting the licenses

Cristan
  • 12,083
  • 7
  • 65
  • 69
posymeon
  • 126
  • 4
  • Well this is weird..I just downloaded the Windows version and it doesn't have /tools either. Could the latest release just not have a /tools folder? That doesn't make any sense. – Joe Morano Feb 29 '20 at 15:57
  • Also, where's your bin folder? – Joe Morano Feb 29 '20 at 15:58
  • Which bin folder? the the cmdline-tools have the following structure 'Android/sdk/cmdline-tools/latest/bin' in there i can see the sdkmanager. – posymeon Feb 29 '20 at 16:04
  • Oh okay. Where did you install cmdline-tools from? – Joe Morano Feb 29 '20 at 16:06
  • I opened the SDK manager -> SDK Tools Tab through the Android Studio. As I remember from previous installations in the list where you see the cmdline-tools there used to be an SDK Tools checkbox, but now it doesn't exist anymore – posymeon Feb 29 '20 at 16:08
  • 1
    Ok, i think i found a solution, we can install the SDK Tools. Open the SDK manager and go to the 'SDK Tools' tab. On the bottom uncheck the 'Hide Obsolete packages' checkbox. After doing that an option to install the 'Android SDK Tools (obsolete)' package will appear. Install them and run the 'flutter doctor' again. And it works after accepting the licesnes. – posymeon Feb 29 '20 at 16:12
  • Same here - just downloaded latest android studio and installed on a fresh new pc - no tools folder. Windows 10, android studio 3.6.1. – Edward Feb 29 '20 at 16:12
  • @PolychronisSymeonidis you are the winner! Your fix worked for me - please post it as the solution! – Edward Feb 29 '20 at 16:15
  • Wooooow yeah that works. Good find. Why would they mark tools as obsolete when literally nothing works without it?? – Joe Morano Feb 29 '20 at 16:17
  • Who knows, maybe an update in flutter will follow the new Android SDK structure. I updated the answer with the solution. – posymeon Feb 29 '20 at 16:19
5

On Ubuntu 20.04 LTS these are my steps to reconcile this problem

  1. Update to the latest version of Android Studio (currently 4.0.1). I'm using the JetBrains toolbox app to install Android studio on Ubuntu.

  2. Install flutter via snap:

sudo snap install flutter --classic
sudo snap install flutter-gallery
flutter channel dev
flutter upgrade
flutter config --enable-linux-desktop
  1. Follow the pictures below to install the command line tools and accept the license for them in Android Studio (see pictures below)

  2. Accept the licenses using flutter doctor

flutter doctor --android-licenses 5 of 6 SDK package licenses not
accepted. 100% Computing updates...         
Review licenses that
have not been accepted (y/N)? y 

Step 3: Follow the pictures to install the command line tools:

  • 3.1 Select the Command line tools (latest) in Android Studio as shown, press OK:

Android SDK Command-line Tools

  • 3.2 Accept the License agreement License Agreement

  • 3.3 Confirm the Change Confirm the Change

  • 3.4 Click Finish Click Finish

Richard Logwood
  • 3,163
  • 23
  • 19
2

The newer versions of Android Studio do not have a /tools directory. The applications are now in "cmdline-tools"

But you can simply link the /tools/bin dir to the /cmdline-tools/latest/bin directory :

Go to your sdk root directory and create a directory named "tools" cd into "tools"

ln -s /path/to/sdk/cmdline-tools/latest/bin/ bin

rerun flutter doctor --android-licenses and you should be golden.

Blockquote

MikeWallaceDev
  • 1,458
  • 2
  • 14
  • 28
0

Uninstall Android Studio first. Then re-install and check, it will work. I did the same.

  • 1
    Although this may work, it is not the desirable solution :) – Javlon May 08 '23 at 11:38
  • This was the solution given in above threads. "You can still install the SDK tools using the SDK manager in the Android studio. Open the SDK manager and go to the 'SDK Tools' tab. On the bottom uncheck the 'Hide Obsolete packages' checkbox. After doing that an option to install the 'Android SDK Tools (obsolete)' package will appear. " – veena sonar May 09 '23 at 12:26
-1

Run flutter doctor in terminal or cmd then type y to accept licenses.

Ali Qanbari
  • 2,923
  • 1
  • 12
  • 28
  • I tried that. I added the result to my question. My entire Android package seems to be incorrect, as I have no tools or bin or sdkmanager folders or files. – Joe Morano Feb 29 '20 at 14:26