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.


Solution 1: Ali Qanbari

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


Solution 2: posymeon

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


Solution 3: Richard Logwood

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


Solution 4: MikeWallaceDev

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