Flutter Android SDK file not found - android

I already have Android Studio installed and tried installing Flutter. After following the instructions, I have encountered a problem. When I run
flutter doctor -v
It returns
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18363.1082], locale en-PH)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d302e2 (3 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\%User%\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
X Android SDK file not found:C:\Users\%User%\AppData\Local\Android\sdk\build-tools\30.0.2\aapt.
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code, 64-bit edition (version 1.48.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.14.1
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
I tried connecting my device too and it didn't recognize, even after enabling USB debugging. I also tried reinstalling Android Studio. I think the issue lies with the missing 'aapt' since it's not on any folder when i manually looked for it but Android SDK file not found: C:\Users\%User%\AppData\Local\Android\sdk\build-tools\30.0.2\aapt tells me it should be there.
Thank you for the help!

try this...
open cmd or terminal and run below command
flutter config --android-sdk <path-to-your-android-sdk-path>
hope this will work

I had the same problem today :
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) X Android SDK file not found: C:\Users\admin\AppData\Local\Android\Sdk\build-tools\30.0.3\aapt.
I fixed it by deleting the two most recent folders in C:\...\build-tools\ which do not contain aapt.exe -> 30.0.2 and 30.0.3 (This deleted folders only contained a folder named .installer).
This answer inspired me : https://stackoverflow.com/a/56995320/13170425

flutter config --android-sdk
run this command and run flutter doctor again this should help you

That's not a big deal. You install the Android SDK and 1 notice that the device is not connected only. You can install the android SDK from the link below:
https://developer.android.com/studio#downloads

I had the same issue
Android SDK file not found: C:\Users\Admin\AppData\Local\Android\Sdk\build-tools\31.0.0\aapt.
I had already tried other solutions but this worked for me . In SDK Manager , go to SDK tools , and check the checkbox "Show the various packages" and uncheck "Hide obsolete packages"
Now under Android SDK Build-tools 31 , install 31.0.0 and apply
Under Android SDK Command-line tools (latest), install Android SDK Command-line tools (obsolete)
This worked for me , hope it works for you too !

Reinstalling the sdk 30.0.2 from sdk manager in android studio(Tools->sdk tools->(tick show package details)) fixes the problem.

I had the same problem today. In my problem, can not find 32 aapt., I had try many:
flutter config --android-sdk [path]
uninstall 32 and install again
install low version like 31(30)
and so on
still not work until:
uninstall 32
remove folder 32 which need aapt.

Related

Unable to run Flutter project on Android after update

I've been trying to get my Flutter project to run after upgrading it to 2.10.4 and it's been a headache from the start. The project runs fine on a browser, but I'm having difficulty running on an Android emulator. I think I'm at the last hurdle, but I'm stumped right now. I'm receiving this error when running on VS Code:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
build-tools;30.0.2 Android SDK Build-Tools 30.0.2
The SDK directory is not writable (C:\Program Files (x86)\Android\android-sdk)
Here's my Flutter Doctor:
PS D:\Documents\Flutter_Projects\glance> flutter doctor -v
[√] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.19043.1586], locale en-US)
• Flutter version 2.10.4 at D:\Programs\flutter_windows_v1.2.1-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Program Files (x86)\Android\android-sdk
• Platform android-31, build-tools 30.0.3
• ANDROID_HOME = C:\Users\reff1\AppData\Local\Android\Sdk
• ANDROID_SDK_ROOT = C:\Users\reff1\AppData\Local\Android\Sdk
• Java binary at: D:\AndroidStudio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.1)
• Android Studio at D:\AndroidStudio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[!] Android Studio (version 4.1)
• Android Studio at D:\Programs\AndroidStudio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code, 64-bit edition (version 1.50.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.17.0
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1586]
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.88
• Edge (web) • edge • web-javascript • Microsoft Edge 99.0.1150.46
[√] HTTP Host Availability
• All required HTTP hosts are available
Here's the part that keeps getting me. I'm seeing I need to run flutter doctor --android-licenses and this is what I get:
PS D:\Documents\Flutter_Projects\glance> flutter doctor --android-licenses
Error: Could not find or load main class Files
I have no clue where to go from here. Any help would be greatly appreciated here. Thank you in advance.
It appears that you have two sets of Android Studio and Android SDK.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Program Files (x86)\Android\android-sdk <--- 1
...
• ANDROID_HOME = C:\Users\reff1\AppData\Local\Android\Sdk <--- 2
[√] Android Studio (version 2021.1) <--- 1
• Android Studio at D:\AndroidStudio
...
[!] Android Studio (version 4.1) <--- 2
• Android Studio at D:\Programs\AndroidStudio
Android Studio version 4.1 is a bit older so I guess you installed it in the past and forgot about it.
Also, it is not normal (or up-to-date) to have Android SDK placed under Program Files.
This is the direct cause of the error. In Windows, writing files under Program Files requires administrator privileges.
Your system is possibly confused because you have a mixed environment with an SDK that requires administrator privileges and one that does not.
My advice is to first uninstall all of them.
Before you begin, find out where the Android Studio configuration files are stored and backup them.
It is documented in here.
Now, completely uninstall all versions of Android Studio and Android SDK, manually delete all environment variables related to Android if any, manually delete (and backup) all configuration files if the uninstaller did not, then make sure all four directories above are empty.
Next, install the latest version of Android Studio and install the Android SDK via Android Studio. At this point, make sure that the installation directory is not under Program Files or Program Files (x86). If it is, then something in the older version is still there and is doing bad things so you have to restart from the first step.
Finally, run flutter clean (just to be sure), then flutter doctor to make sure only one of each is detected.
In android studio update your sdk 30
Unable to determine bundled Java version.
• Try updating or re-installing Android Studio
See in your error in flutter doctor
Change the ownership of Android SDK:
sudo chown -R $(whoami) $ANDROID_HOME
For this issue : Android license status unknown.
Type in command prompt
flutter doctor --android-licenses
Type Yes/y/Y to accept licenses
Maybe it's an emulator specific issue, did you try to run it on a real device?
Regarding the android license issue you are getting, I guess that the system is not recognizing JAVA or it needs to be updated so please check that.
Also make sure that the emulator itself is updated and not only the android SDK, go to SDK manager and check all the dashed components:
If this didn't work, delete the emulator and create a new one, and if that didn't help, delete all instances of android studio as I see 2 on your system that might conflict the SDK path.

ERROR: JAVA_HOME is not set and no 'java' command could be found in your flutter PATH. In Flutter

I installed Android Studio 4.1 and tried to run the existing project. But it gives an error like this:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
You have to set the JAVA_HOME Environment Variable.
On Windows, I solved the issue as follows:
Download the Java JDK from here and install it. (This links to version 15, which requires you to create an account in order to download. Version 16 is available to download without creating an account, but it has caused me an error that required me to downgrade.)
Set the "JAVA_HOME" Environment Variable:
Open Windows Search, type in “env”, and choose “Edit the system environment variables”.
Click on "Environment Variables...".
Click on "New".
Fill in the "variable name" field with "JAVA_HOME".
Fill in the "variable value" with the path to where Java is installed on your computer. (for me it was under "C:\Program Files\Java\<jdkversion>".)
Click "OK" and close all dialogs.
Restart your IDE / Terminal. (do not skip this step)
On Ubuntu 20.04 with Android 4.1, this error can be solved using the Snap version with:
flutter config --android-studio-dir=/snap/android-studio/current/android-studio
For Windows :
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
This command works fine if you have Android Studio installed. Flutter can understand the configurations of the Android Studio and you don't have to provide JAVA_HOME anymore.
Edit (Bonus) :
Also, download "Android SDK Command-line Tools" in android studio for android-licenses. Steps are shown in the image below.
You need to install Java JDK software which is required for the android studio.
sudo apt install openjdk-11-jdk
UPDATE: run flutter upgrade to upgrade to Flutter 1.22.2, which fixes compatibility issues with Android Studio 4.1. See related Flutter release.
This issue has been resolved v
See this issue regarding Android Studio 4.1 and Flutter
You can either downgrade back to Android Studio 4.0.2 or you can
install the latest JDK and update your JAVA_HOME variable and
PATH (OS dependent).
Note that if you choose to continue using 4.1 instead of downgrading,
flutter doctor will tell you Android Studio is not installed.
You need to run flutter config --android-studio-dir='<path to android studio>' in order to fix this issue. flutter doctor will now also
incorrectly report that the Flutter and Dart plugins are not
installed even if they are - you can ignore this.
Install Android Studio (skip this step if you already installed)
Goto
C:\Program Files\Android\Android Studio\jre and copy the path.
Make New variable called "JAVA_HOME". And paste above path as the variable value.
I set my JAVA HOME to the path,
/snap/android-studio/97/android-studio/jre/
Then I set my android studio config in flutter by using this command:
flutter config --android-studio-dir=/snap/android-studio/current/android-studio
My system is :
Ubuntu 20.04 with Flutter plugin version as 4.1,
In Mac:
In your terminal run
ECHO $JAVA_HOME
This will bring up the current path of java home.Pay close attention to the path that the terminal outputs.In my case i had System/Library instead of /Library/.../... typo as my path.So i simply corrected this in bash_profile.
If your path is correct but the error persists,
Right Click On Finder
Go To Folder
Bash_Profile
Add or Edit the Java Home Path
The path you add here should be the one your terminal output when you ran Echo $Java_Home..As long as this path that was echoed was/is correct..the below steps should fix the issue.
Then open your zshrc in a similar manner as you did with bash_profile and add the home path to the file.
You can also edit the bash_profile and zshrc files in your text editor.These files can be displayed using cmd + shift + . in your home folder.
After that,save,exit the terminal, close android studio and restart your machine.
Read this Article to learn more.
Locate where your Android Studio is installed.
For me C:\Program Files\Android\Android Studio
Check if the jre folder exists, Create a new folder called jre
Copy the contents of the jbr folder and paste them into the jre folder.
Check by running flutter doctor, and Restart IDE.
Thanks: roufy235 {cause}
For ubuntu 20.04 this solution will be appropriate: -
This link solved my problem. In short I would recommend to follow the simple steps, i.e.
Upgrade the flutter using flutter upgrade
Set the path of the flutter flutter config --android-studio-dir="/path/to/android/studio/"
Set the path in bashrc file by opening bashrc file(it is a hidden file)
export JAVA_HOME="/path/to/android/studio/jre/"
choco install javaruntime
If you use choco package manager. It will set the vars automatically.
This issue can also be caused if you have updated your Android Studio.
In that case.
For Windows
First Open the Users\username\AppData\Local\Google directory on your PC/Laptop and make sure to Delete the older version of your Android Studio.
e.g, Current version of Android studio is Electric Eel (2022.1).
Delete any other older version from that directory accordingly and restart your PC or Laptop.
Then try running your project.
Install openjdk-8 ....
You have to restart your terminal, the issue will persist even after download if you don't restart the terminal.
Follow react native guide to download openjdk for your environment. ...
https://reactnative.dev/docs/environment-setup
For Windows this worked
Go to C:\Program Files\Android\Android Studio.
Copy all the files inside of jbr directory.
Paste all the files into jre directory.
Then run flutter doctor. The issue will go away.
D:\Flutterproject\rechyriedapp>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.1105], locale en-IN)
• Flutter version 3.3.8 on channel stable at C:\flutter_windows_3.3.8\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\USER\AppData\Local\Android\Sdk
• Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
X No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and the java binary in your PATH. You can download the JDK from https://www.oracle.com/technetwork/java/javase/downloads/.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.22000.0
[!] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] Connected device (4 available)
• CPH2095 (mobile) • 86db9605 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1105]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.55
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
After that copy all file from jbr to jre
D:\Flutterproject\rechyriedapp>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.22621.1105], locale en-IN)
• Flutter version 3.3.8 on channel stable at C:\flutter_windows_3.3.8\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\USER\AppData\Local\Android\Sdk
• Platform android-TiramisuPrivacySandbox, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.4.33213.308
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[√] Connected device (4 available)
• CPH2095 (mobile) • 86db9605 • android-arm64 • Android 12 (API 31)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1105]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.55
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Download Liberica JDK and on installation it will automatically set JAVA_HOME environment variable.
Now you just go to Android Studio -> Project Structure -> SDK -> Point all jdk path to liberica jdk installation directory and apply.
You are done. Just restart android studio and gradle command will work.

Android Studio - Flutter plugin not installed; this adds Flutter specific functionality

Considering that I had followed all this steps https://flutter.dev/docs/get-started/install/linux in my Ubuntu 18.04LTS, why this following problem continues to appear:
$ flutter doctor -v
[✓] Flutter (Channel stable, v1.7.8+hotfix.2, on Linux, locale en_US.UTF-8)
• Flutter version 1.7.8+hotfix.2 at /opt/flutter
• Framework revision 2e540931f7 (2 weeks ago), 2019-07-02 09:31:07 -0700
• Engine revision b1cb0d9e9b
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/rodrigo/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/rodrigo/Android/Sdk
• Java binary at: /usr/share/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
• All Android licenses accepted.
[✓] Android Studio (version 3.4)
• Android Studio at /usr/share/android-studio
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
[!] Android Studio
• Android Studio at /opt/android-studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API
29) (emulator)
! Doctor found issues in 1 category.
Different from another similar questions here in StackOverflow, before I've installed flutter plugin the "[✓] Android Studio (version 3.4)" was equal to "[!] Android Studio", with same error messages. After I've installed flutter plugin (and dart), only "[!] Android Studio" still displaying the error.
Does someone know why? I've made many searches in my files, I have only one Android Studio installed. Why displays two? What "[!] Android Studio" refer to? Does command "$ flutter doctor" have a problem?
This post is for those who have gotten the plug-ins installed but still receive the warning.
Note: The Flutter team has created an issue for the inability of doctor to detect installed plug-ins. It's a know issue and they are looking to deprecate this detection feature of doctor:
https://github.com/flutter/flutter/issues/61246
My flutter and dart plug-ins are correctly installed but I still get the warning.
[!] Android Studio (version 4.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
In my case ignoring the warning worked fine.
I tried re-installing plug-ins several times but that did not remove the warning from flutter doctor.
However, everything works fine. I can successfully create and run apps created from
the command line with flutter create
from Android Studio with File->New->New Flutter Project
I'm on Ubuntu 20.04 LTS and Android Studio 4.0.1 (installed through JetBrains toolbox)
I installed flutter via the snap store:
sudo snap install flutter --classic
sudo snap install flutter-gallery
flutter channel dev
flutter upgrade
flutter config --enable-linux-desktop
# wanted to try web, apparently requires beta channel
flutter channel beta
flutter channel upgrade
flutter config --enable-web
FYI, it took me a while to understand where the Flutter SDK was located. It is here: /home/(username)/snap/flutter/common/flutter
Plugins installed correctly, but still get warning:
This can be solved in simple steps:
Step 1: Open Android Studio
Step 2: Open Android Studio Preferences
Step 3: Go-to Plugins tab
Step 4: Click on MarketPlace tab
Step 5: Search for flutter in search box
You will see a list of plugins related to flutter. Click on the first one and check which version it is. Currently, the latest version is 37.1.1.
Step 6: Click on install. (It may ask you to install dart plugin also. Hit yes and android studio will install dart and flutter for you)
Ready to rock !
I recently encountered this problem, I first tried to update the flutter and dart plugin from the android studio market place, but that did not work
Finally, I run the following command and it worked like a charm
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
Note: I'm on Mac OS running android studio 4.1

How to fix "Android license status unknown" in flutter

my flutter doctor -v result:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.472], locale fa-IR)
• Flutter version 1.0.0 at C:\Android\flutter
• Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at c:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 27.0.3
• ANDROID_HOME = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] Connected device (1 available)
• HUAWEI CUN U29 • CCMBBCB6C0153603 • android-arm • Android 5.1 (API 22)
and when run:
flutter doctor --android-licenses
get me this result:
A newer version of the Android SDK is required. To update, run:
c:\Android\android-sdk\tools\bin\sdkmanager --update
and when update sdkmanager show this error to me:
Exception in thread "main" java.lang.NoSuchFieldError: FN_AAPT2
at com.android.sdklib.BuildToolInfo.<init>(BuildToolInfo.java:362)
How can i solve this challenge?
I solved this problem by installing the command line tool.
And then rerun
flutter doctor --android-licenses
I have followed these steps. It worked for me.
went to Environment variables and added ANDROID_HOME with a variable value of:
C:\Users\%username%\AppData\Local\Android\Sdk
then my JAVA_HOME with this variable value:
C:\Program Files\Android\Android Studio\jre
then my Path with this variable value:
C:\Users\%username%\flutter\bin
then I ran the following command
flutter doctor
Got the output of Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309],
locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --
android-licenses
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
! Doctor found issues in 1 category.
Then I ran
flutter doctor --android-licenses
and accepted all Terms & Conditions with (y)
Install Android SDK Command-line Tools on android studio using the SDK manager
Run flutter doctor --android-licenses
Now this problem with the license has got to do with the java development kit(JDK) version.
For some reasons if you are not using JDK 8 or below, you will unfortunately get license issues.So basically uninstall current version and install JDK 8 or below. Check link below and follow the conversation carefully.
https://github.com/flutter/flutter/issues/16025
I solved pb (jdk11 on Win10 at beginning) following Nitesh steps (thanks) but with some change due to win10 strange behavior ( i know...).
To objectify, create two environment'variables with win10 wizards :
I strike :
TEST1 C:\Users\%username%\XXX
TEST2 %USERPROFILE%\YYY
Appear correct in wizard:
TEST1 C:\Users\pirla\XXX
TEST2 C:\Users\pirla\YYY
But in a dos command window, this comes to SYSTEM in first case despite correct username :
C:\Users\pirla>echo %username%
pirla
C:\Users\pirla>set TEST
TEST1=C:\Users\SYSTEM\XXX
TEST2=C:\Users\pirla\YYYY
So replace
C:\Users\%username%\
by
%USERPROFILE%\
and averything is ok.
( by the way, if you have also an JRE_HOME , change it too )
HTH
There is an SDK Manager Icon in the top right of Android Studio between the AVD manager icon and the magnifying glass. Click it.
You get a modal that shows you are in System Settings -> Android SDK n the left menu. In the middle area there is an SDK Tools tab so click it.
Check off the box that says "Android SDK Command-line Tools (latest)" and click Apply. It will install it (about 105M). Now run flutter doctor --android-licenses and say yes to everything. The error should be gone.
Use flutter_console instead of CMD
flutter doctor --android-licenses
This worked for me:
open Android Studio's SDK Manager
go to the Android SDK tab
under SDK Tools, uncheck Hide Obsolete Packages
install Android SDK Tools (Obsolete)
SOLUTION: None of the above works when setting up a Windows 10 Flutter 1.17.1 environment for mobile development. The quickest and easiest solve is to download android-studio-ide-193.6514223-windows (Android 4.0) from https://developer.android.com/studio/archive.
Download Android 4.0
Install Command
Line Tools in SDK Settings
Reboot Open Command Prompt
flutter doctor -v
You must install Android SDK Command-line Tool(Latest).
Go to SDK Manager in android studio, in tab SDK Tools, check in Android SDK Command-line Tool(Latest) and then click "apply".
On Windows:
open cmd and run:
android update sdk
After that run flutter doctor again
in terminal :
flutter update
flutter doctor --android-licenses
accept all terms by y
Uninstall Android Studio or the Android SDK. Reinstall it.

Flutter not detecting Android SDK

I've been trying to get flutter to detect the Android SDK.
flutter doctor
returns
PS I:\Projects\Flutter\fluttertest\flutterproject> flutter doctor -v
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version
10.0.16299.248], locale en-US)
• Flutter version 0.1.5 at I:\Source\flutter
• Framework revision 3ea4d06340 (7 days ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[!] Android toolchain - develop for Android devices
• Android SDK at C:\NVPACK\android-sdk-windows
• Android NDK location not configured (optional; useful for native profiling support)
• ANDROID_HOME = C:\NVPACK\android-sdk-windows
X Android SDK is missing command line tools; download from "link to google"
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
[√] 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)
[√] VS Code (version 1.20.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Dart Code extension version 2.9.2
[√] Connected devices (1 available)
• Nexus 6P • 8XV7N16A04000597 • android-arm64 • Android 8.1.0 (API 27)
! Doctor found issues in 1 category.
I've tried downloading the SDK Tools Package and even Installed Android Studio
and added it to PATH, but was unable to resolve the issue.
The current Android installation sits in a directory called C:\NVPACK, and although I do remember fiddling with it, I don't remember which program installed it. I'm considering removing it. Any help would be greatly appreciated.
Flutter provide command to update our Android SDK path:
Use flutter config --android-sdk <path-to-your-android-sdk-path>
Or just add a variable ANDROID_HOME with your sdk location in user variables
It turns out that I had NVIDIA CodeWorks installed. I believe it was part of my VS2017 installation options. I've removed it and modified my ANDROID_HOME Environment Variable and removed all of the variables associated with the NVPACK folder. (thanks to everyone (1) who helped me offsite!)
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.
Open Android Studio.
Click on Tools go to Sdk manager.
Then click on SDK tools.
Unchecked Hide Obsolete Packages then Check Android SDK Tools.
Then Tools will be install after that you can set the path and check the connectivity.
Your problem will resolve.
Go into C:\Users\asus\AppData\Local\Android\sdk, double cliclk on sdk mannager.exe and update all packages.
It will take around 10 minutes to update which also depends on your internet speed.
You need to install the command-line tools inside Android studio, as explained here:
Flutter doctor error - Android sdkmanager tool not found. Windows
For Mac Users use:
flutter config --android-sdk /Users/<your-user>/Library/Android/sdk
I have installed Flutter with Android Studio many times. And I found most of the installation errors were because of poor network connection. When I use fast internet service, Flutter Environment was set up within an hour without any issue.
Internet speed is very important while Flutter, Android Studio, and SDK installation.
Best,
Ahmed I.
1- Activate Command-line Tools and download it as in this picture
2- Add Android SDK path to your system environment variables.
this link would help you..

Categories

Resources