Android sdk file not found after running flutter doctor - android

The error on cmd says android SDK file not found: C:\Users\Me\AppData\Local\Android\Sdk\build-tools\29.0.3
after running flutter doctor on flutter console.
Android Studio seems to work fine.
my sdk is located at C:\Users\Me\AppData\Local\Android\Sdk\extras
What could be a solution to this?

If Android studio is working fine but your command line is not, the issue is likely your Path variables. Check out the "Update Your Path" section of the Windows installation tutorial.

It is simple. Follow these three steps to solve the issue.
Open SDK Manager
Select Android SDK Build-Tools and uninstall it.
Then reinstall the required SDK Build-Tools version (in your case 29.0.3)
That's all.

Related

Android SDK Tools option is missing from SDK Manager in Android Studio 3.6.1

On a freshly installed macOS Catalina, I installed Android Studio 3.6.1.
I've got the following error when I ran flutter doctor in the course of setting up flutter SDK on my Mac.
[!] 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.
I re-installed Android Studio and follow the instructions in the second link in the error message, but these links do not seem to help resolving the issue. I also tried the following:
$ flutter doctor --android-licenses
Which gives the following error:
Android sdkmanager tool not found
(/Users/username/Library/Android/sdk/tools/bin/sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
I checked my installation and found out that tools directory is missing under ~/Library/Android/sdk/.
Also, I found out Android SDK Tools option is missing from SDK Tools tab in SDK Manager of the Android Studio as shown in this screenshot. (Android SDK Tools option was present on my previous installation of Android Studio 3.5.3.)
Has anyone had the similar problem? I am not sure what I'm doing wrong. If anyone can show me how I can fix this issue, I'd appreciate it! (This is my first question on Stack Overflow. Please excuse me for lengthy post.)
I'm using Linux but I guess the problem might be the same.
Launch Android Studio and go to "SDK Manager" - you can launch it after creating a blank project and going "Tools -> SDK Manager" under the "AVD Manager" option. In the new window open "System Settings -> Android SDK". From there pick "SDK Tools". Now you need to uncheck the "Hide Obsolete Packages" option in the bottom of the window. Now there should appear a new option: "Android SDK Tools (Obsolete)" - check that, hit "Apply" - it will download the files and "Tools" folder will appear in the Android folder. Then simply run "flutter doctor" in the terminal and you should be asked to accept some licenses - simply run:
$ flutter doctor --android-licenses
It helped me. I don't know why this option went obsolete when Flutter requires it anyway. Check the settings printscreen.
Step1. Download latest sdk tools from https://androidsdkmanager.azurewebsites.net/SDKTools.
up to 2020-03-08 the latest version is 26.2.0.
Step2. Unzip and then copy "tools" folder into android-sdk folder. "tools" and "build-tools" is in the same depth.
Step3. flutter doctor --android-licenses
Step4. flutter doctor
Open the Android Studio SDK Manager
In the Android SDK tab, uncheck Hide Obsolete Packages
Check Android SDK Tools (Obsolete) Check and download it!
I had a similar problem with Android Studio 3.6.1 (not involving flutter): the platform-tools directory got installed within another platform-tools directory, so Android Studio couldn't find adb, and so couldn't communicate with my phone. A completely fresh re-install of Android Studio didn't even help. I ended up manually moving the platform-tools one directory up and that fixed it:
% cd ~/Library/Android/sdk
% mv platform-tools platform-tools-bad
% mv platform-tools-bad/platform-tools .

Flutter : No valid Android SDK platforms found in /usr/lib/android-sdk/platforms. Directory was empty

I have already installed the latest Android Studio and Android SDK on my computer. But I still have this trouble, anyone can help me to fix this? Thanks
In Android Studio go to menu > Tools > SDK Manager
and ensure you have at least one platform selected, like Android 9.0 (Pie)
Click "OK" to start installation.
You can open SDK manager again and check it shows "Installed" on the right.
When it is done, check flutter doctor -v again.
Flutter provide a command to update the SDK path.
flutter config --android-sdk <SDK folder>
For example, if the sdk installation is /opt/android/sdk, the command is:
flutter config --android-sdk /opt/android/sdk

Flutter does not find android sdk

I just tried intalling flutter and since I already had android studio and the android sdk installed I just followed the installation of flutter. Here is my problem: When I run
flutter doctor
It tells me
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.16299.248], locale en-US)
• Flutter version 0.1.5 at C:\Users\Name\git\flutter
• Framework revision 3ea4d06340 (2 weeks ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[X] Android toolchain - develop for Android devices
X ANDROID_HOME = C:\Users\Name\AppData\Local\Android\sdk\Android
but Android SDK not found at this location.
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
Which tells me that flutter is not finding my Android sdk (even though it is the path that android studio uses aswell - and android studio is working fine)
I already tried reinstalling the sdk but it did not work.
Im very thankful for any help with this.
Flutter provides a command to update the Android SDK path:
Use :
flutter config --android-sdk <path-to-your-android-sdk-path>
Kindly first of all check your latest sdk
first step:
second step:
Now Run
run flutter doctor --android-licenses
Press Y against each agreement
run flutter doctor
it will work fine.
Choose the folder to install (I called it BASE_PATH) and use the following commands to install SDK with flutter:
Install SDK
cd $BASE_DIR
mkdir android-sdk
cd android-sdk
wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
unzip commandlinetools-linux-6200805_latest.zip
./tools/bin/sdkmanager --sdk_root=$(pwd) "build-tools;28.0.3" "emulator" "platform-tools" "platforms;android-28" "tools"
I used a separate folder for SDK, because it will add parent folders.
Install Flutter
cd $BASE_DIR
wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.8-stable.tar.xz
tar xvf flutter_linux_v1.12.13+hotfix.8-stable.tar.xz
Export Vars (you can add them to your .bashrc)
export ANDROID_SDK=$BASE_DIR/android-sdk
export ANDROID_PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
export FLUTTER=$BASE_DIR/bin
export PATH=$PATH:$ANDROID_PATH:$FLUTTER
Check!
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (not installed)
[✓] VS Code (version 1.31.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
I have got following issue on Flutter Doctor command.
X Android SDK file not found: ..\Android\sdk\platforms\android-28\android.jar.
to fix this just go to Tools=> Android Sdk =>Update Sdk Platform for which issue is there.(I installed SDK 28).
check flutter document for this issue
In my SDK folder there were a empty folder (/build-tools/29.0.0)
I deleted it, and it worked fine
I spent a lot of time solving this.
Eventually what worked was going to project settings in android studio, sdk tools, uncheck hide obsolete packages and install sdk tools obsolete package.
Then run flutter doctor --android-licenses and then flutter doctor showed a green tick on my android toolchain.
Hope this helps someone.
For mac users,
It was working fine yesterday, now the hell broke. I was able to fix it.
My issue was with ANDROID_HOME
// This is wrong. No idea how it was working earlier.
ANDROID_HOME = Library/Android/sdk
If you did the same, change it to:
ANDROID_HOME = /Users/rana.singh/Library/Android/sdk
.bash_profile has
export ANDROID_HOME=/Users/rana.singh/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
If you don't find the proper SDK path then,
Open Android Studio
Go to Tools
Go to SDK Manager
You will find the "Android SDK Location"
Copy the path and edit "the Environment Variable"
After that, restart and run the command.
Then, run "flutter doctor"
Hope, it will work!
Flutter say Sdk build tool version(exp:android toolchain - develop for android devices (android sdk 28.0.3)) version=28.0.3
go to home/username/Android/Sdk/build-tools
delete this version(28.0.3) and fixed bug
To open Tools=> Android Sdk
Click SDK tools tab => check show package details and check all 28 SDK version
install that and to fix the issue
Flutter is designed to use the latest Android version installed. So if you have an incomplete download of the latest Android, Flutter will try to use that.
So either complete the installation or delete the complete installation. You can find the Android versions at: /home/{user}/Android/Sdk/platforms/android-29/android.jar
First open Android SDK Manager and make sure the required SDK's are installed.
Now open SDK manager, copy the SDK path. Open cmd
cd C:\Users\your-username\AppData\Local\Android\Sdk\build-tools
now again Change dir to the inner folder in build-tools.
check the presence or the name issues of the aapt.exe file.
I assume this is this known issue https://github.com/flutter/flutter/issues/13750
You need to fix the path to the SDK manually until this is fixed
in the file
my_flutter_project/android/local.properties
update
Add $ANDROID_HOME\sdk\tools and $ANDROID_HOME\sdk\platform-tools to the PATH environment variable.
For me, adding the Android SDK path didn't help.
I deleted all my SDKs (basically just deleted that Android folder. Used this path "C:\Users\your_user_name\AppData\Local\Android" to locate it.)
I then reinstalled all the required SDKs using android studio. (Be sure to install more than 1 SDK, I don't know why it doesn't work if you only install 1).
Then if I run Flutter Doctor, every thing works perfectly.
You have to set ANDROID_HOME variable to SDK.
Create a new variable by the name and set it to the installation directory.
Make sure SDK is not below 2 subfolders from c drive or any windows root drive.
I solved this problem by below step,
1) go to -> system environment -> Environment Variables -> system Variable
2) create New Variable Name ANDROID_HOME and Value D:\Androidsdk\tools (custom android sdk path).
3) concat this path D:\Androidsdk\platform-tools in Path variable value using ";". (also in system Variable)
4) that's all, Restart the PC to apply changes and try again -- flutter Doctor.
Flutter provides a command to update the Android SDK path:
flutter config --android-sdk < path to your sdk >
OR
If you are facing this issue --> sdk file is not found in android-sdk\build-tools\28.0.3\aapt.
You may have probably not installed build tools for this Api level, Which can be installed through this link https://androidsdkmanager.azurewebsites.net/Buildtools
This article explained how to solve it through Android Studio, since you don't need to install the SDK Manager separately when you use Android Studio.
REFERENCE: https://flutter-examples.com/flutter-command-line-tools-component-is-missing/
Open Android Studio
More Actions >>> SDK Manager
Android SDK >>> SDK Tools
Check "Android SDK Command-line Tools (latest) >>> OK
Restart your command line window and run flutter doctor again to verify
I don't have Android Studio installed, only VS Code and extract sdk in C:\Android\.
For solution, I'm set directly path:
flutter config --android-sdk "C:\Android\cmdline-tools\latest\bin"
First run flutter upgrade from your terminal ,
If you get the following error,
ANDROID_HOME = C:\Users\Name\AppData\Local\Android\sdk\Android
but Android SDK not found at this location.
First go to android studio, Settings->System Settings->Click the expand arrow
Then go to the Android SDK option and add the corresponding SDK to the project then go to Project Structure and add the respective SDK to the project Structure
Then run flutter upgrade in the terminal
We need to manually add the Android SDK. The instructions in the flutter.io/download say that the Android Studio 3.6 or later needs the SDK to be installed manually. To do that,
Open the Android Studio SDK Manager
In the Android SDK tab, uncheck Hide Obsolete Packages
Check Android SDK Tools (Obsolete)
Please refer the Android Setup Instructions.
What worked is Tools->Flutter->open Android module in Android studio, For me plugin flutter_email_sender was giving this error, so I copied local.properties file into it and the build become successful.
Or
Open Terminal
Run touch ~/.bash_profile; open ~/.bash_profile
export ANDROID_HOME=/Users/<macusername>/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/<macusername>/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Run source ~/.bash_profile in android studio terminal
This solved my issue.
Step 1: In search type show hidden files and enable it.
Step 2: Go to C directoy> users>
Step 3: In that navigate to AppData>Local>Android>Sdk
Step 4: Copy the path to this folder
Step 5: Open power-shell and type in:
flutter config --android-sdk "C:\Users\<folder under your name>\AppData\Local\Android\Sdk"
export ANDROID_HOME=$HOME/Development/android_sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/cmdline-tools
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$HOME/pathto/flutter_sdk/bin
`PWD this won't work I guess
goes in .zprofile or .zshrc un the respective user directory of mac
go to local.properties in project/android/local.properties
change this
sdk.dir=C:\\Users\\ACER\\AppData\\Local\\Android\\sdk
to
sdk.dir=A:\\yoursdkfolder\\sdk
I tried the best answer but it didn't work for me.
Running flutter doctor-v gave me a tip that worked.
Just run flutter config --android-studio-dir=
It will ask you to restart VS Code again.
Delete the terminal in VS Code and restart VS Code.
Run flutter doctor-v again and the issues was sorted for me.
I tried many solutions and spent a lot of time then finally I removed the error by following steps-
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) X Android SDK file not found: C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3
delete this folder inside build-tools (because the error is not installed properly).
for resolving this issue, we have to uncheck all the latest plateforms (android (S)12 etc) and click apply after this restart the studio and check all these platforms again at least one latest and apply(ok).
Open Android Studio->files->Settings->Appearence & Behavior->System
Settings->Android SDK->SDK plateforms(Latest)
run flutter command to accept the licenses. (type Y then enter for all)
flutter doctor --android-licenses
run flutter doctor ( all is done).
Regards!
Dinesh Prajapati
I am using Visual Studio Code and Flutter 3.3.3. The above answers did not work for me. I followed the below steps to solve the problem:
Downloaded the latest Android command-line tools from https://developer.android.com/studio#command-tools
Unzipped the downloaded .zip file and went inside the extracted folder
Executed the below command in command-prompt (as administrator) to install the Android SDK packages:
bin\sdkmanager.bat --sdk_root=<android_sdk_path> "build-tools;28.0.3" "emulator" "platform-tools" "platforms;android-29" "tools" "cmdline-tools;latest" "system-images;android-29;google_apis_playstore;x86"
"system-images;android-29;google_apis_playstore;x86" is needed for
adding device emulator
Set the Android SDK path for flutter:
flutter config --android-sdk <android_sdk_path>
Accept the Android licenses for flutter:
flutter doctor --android-licenses
You are done. You can verify the installation using flutter doctor command. You should see something like this:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.3, on Microsoft Windows [Version 10.0.19044.2006], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.5)
[!] Android Studio (not installed)
[√] Connected device (3 available)
[√] HTTP Host Availability
! Doctor found issues in 1 categories.
I also have the same problem in windows, and It's come while authorizing android licenses. flutter doctor --android-licenseserror
for resolving this issue we only have to install Android SDK command-line Tools(Latest)
Open Android Studio->files->Settings->Appearence & Behavior->System Settings->Android SDK->SDK Tools->(install) Android SDK command-line Tools(Latest)

Cannot find a compatible Android SDK for compilation when running `tns platform add android`

I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.
When running tns platform add android I receive the following error:
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.
The tns doctor command also returns warnings on android-sdk issues:
Cannot find a compatible Android SDK for compilation. To be able to
build for Android, install Android SDK 21 or later. Run $ android to
manage your Android SDK versions. You need to have the Android SDK
Build-tools installed on your system. You have to install version 22.
Run "android" from your command-line to install required Android Build
Tools. You need to have the latest Android Support Repository
installed on your system. Run $ android to manage the Android
Support Repository.
My android-sdk installation looks like this:
My .bash_profile also includes the followings:
export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"
export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"
Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...
Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes,
specifically 22.x.x)
Make sure you have Android support repository installed. (You can
find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.
This is because of sudo. The root user has no ANDROID_HOME set.
For Windows User:
Run 'android update sdk' from command line
Select Android 5.1.1(API22)
Select Tools folder
Select Extras and click on Install.
ps:- adding this answer, so that if any one land on this page can see it.
Check the ANDROID_HOME is ok
Install the API 22 + ion the Extras > Android Support Repository
Run the following
tns platform remove android
tns platform add android#next
Run
tns run android
then it should be OK
I solve this problem installing Android Support Repository from Extras.
updating SDK in AndroidStudio >> Preferenceswould help
on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed
C:\Program Files (x86)\Android\android-sdk
This answer is on a Linux, not OSX, platform. However, since this is the SO that appears most often for the listed error, I'll share a recent fix that worked for me.
If you have done all of the above and are still getting the error, try this solution.
I am using NativeScript 8.0.2.
You will know that ANDROID_HOME and Java are configured correctly if you can run the command $ANDROID_HOME/tools/bin/sdkmanager --list. If that fails, then first check that your Java is compatible (I had to add OpenJDK 8 and change my PATH with export JAVA_HOME="/usr/lib64/jvm/java-1.8.0/")
In Android Studio, add a previous build tool version. Go to your SDK Manager > SDK Tools, tick the bottom box "Show package details", and add a previous version. In my case, 31.0.0 was the latest, and I added 30.0.3. Now run ns doctor android again and everything should pass.
Seems 31.0.0 is not yet properly recognised by Native Script.
I always got the error "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. "
I actually had to go to the android studio settings and install the exact SDK 28 before this error went away.
Android Settings Pic
This is an updated answer, I also had the same issue:
Like all the previous pictures above, I had to install the SDK platforms, using the SDK Manager. From the main screen of Android Studio, click More Actions and choose SDK Manager. Before that I had to add the platform-tools to my PATH in Windows
%LOCALAPPDATA%\Android\Sdk\platform-tools
That fixed my issue and the docs for setup are here.

SDK Manager Android Studio OS X

How do you open SDK Manager on the latest Android Studio in OS X? It appears grayed out in the initial screen and it seems I don't have any SDK installed...
Close all open projects so you get the opening screen.
Choose Configure -> Project-Default -> Project Structure
Then set the path to your SDK and JDK, respectively.
Mine are:
SDK: /Users//Development/android-sdk
JDK: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
If you are on OSX, your JDK might be similar, your SDK will be wherever you put it.
Since the SDK doesn't come with Android Studio, you have to install it manually.
You can use brew with brew install android-sdk and then you can open it via android (All done in the terminal)
For me, I found that the android binary was missing from the Studio.
So I downloaded the SDK, and moved it in.
Path is as given by #Cory, /Users/<user>/Library/Android/sdk

Categories

Resources