Reputation: 1895
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?
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.
Upvotes: 3
Views: 18478
Reputation: 186
Although this thread is quite stale, I will add what worked for me with the Flutter doctor error of:
[✗] Android toolchain - develop for Android devices ✗ ANDROID_HOME = ~/Library/Android/sdk but Android SDK not found at this location.
This is on a Macbook Pro M1 running updated Flutter and Android SDK updated.
I had to reset my link in order to resolve the issue:
flutter config --android-sdk /Users/craigema/Library/Android/sdk/
Note that the previous path added /tools/bin which I removed due to the newest Android SDK removing the tools dir.
Hope this helps someone.
Upvotes: 0
Reputation: 1
Uninstall Android Studio first. Then re-install and check, it will work. I did the same.
Upvotes: 0
Reputation: 136
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
Upvotes: 12
Reputation: 1468
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
Upvotes: 2
Reputation: 3273
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.
Install flutter via snap:
sudo snap install flutter --classic
sudo snap install flutter-gallery
flutter channel dev
flutter upgrade
flutter config --enable-linux-desktop
Follow the pictures below to install the command line tools and accept the license for them in Android Studio (see pictures below)
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
Upvotes: 5
Reputation: 3111
Run flutter doctor
in terminal or cmd then type y
to accept licenses.
Upvotes: -1