If you encounter the "android sdk manager not found" error when running flutter doctor --android-licenses, it typically indicates that the Flutter SDK is unable to locate the Android SDK on your system. To resolve this issue, follow these steps:
Install Android SDK: Make sure you have the Android SDK installed on your system. If you haven’t installed it yet, you can download it from the official Android website: https://developer.android.com/studio#downloads
Set ANDROID_HOME Environment Variable**: After installing the Android SDK, you need to set the ANDROID_HOME environment variable to point to the location where the Android SDK is installed. The steps to set environment variables differ depending on your operating system:
Windows:
Go to "Control Panel" > "System and Security" > "System" > "Advanced system settings".
Click on the "Environment Variables" button.
Under "System Variables," click "New" and set the variable name to ANDROID_HOME.
Set the variable value to the path of the Android SDK (e.g., C:AndroidSDK).
Add the following line to set the ANDROID_HOME variable:
export ANDROID_HOME=/path/to/your/Android/sdk
Save and close the file. Then, run source .bash_profile or source .bashrc to apply the changes.
Add SDK Tools to PATH: In addition to setting the ANDROID_HOME variable, you also need to add the Android SDK’s tools and platform-tools directories to your system’s PATH variable.
Windows:
Append %ANDROID_HOME%tools and %ANDROID_HOME%platform-tools to the PATH variable in the same "Environment Variables" window where you set ANDROID_HOME.
Restart your terminal: After making changes to environment variables and PATH, close and reopen your terminal or command prompt for the changes to take effect.
Run flutter doctor --android-licenses: Now, try running flutter doctor --android-licenses again in your terminal. It should successfully launch the Android SDK Manager and ask you to accept the licenses for various components.
If you followed the steps correctly, the error "android sdk manager not found" should be resolved, and you should be able to accept the Android SDK licenses successfully.
2
Answers
If you encounter the "android sdk manager not found" error when running
flutter doctor --android-licenses
, it typically indicates that the Flutter SDK is unable to locate the Android SDK on your system. To resolve this issue, follow these steps:Install Android SDK: Make sure you have the Android SDK installed on your system. If you haven’t installed it yet, you can download it from the official Android website: https://developer.android.com/studio#downloads
Set ANDROID_HOME Environment Variable**: After installing the Android SDK, you need to set the
ANDROID_HOME
environment variable to point to the location where the Android SDK is installed. The steps to set environment variables differ depending on your operating system:Go to "Control Panel" > "System and Security" > "System" > "Advanced system settings".
Click on the "Environment Variables" button.
Under "System Variables," click "New" and set the variable name to
ANDROID_HOME
.Set the variable value to the path of the Android SDK (e.g.,
C:AndroidSDK
).Add the following line to set the
ANDROID_HOME
variable:Save and close the file. Then, run
source .bash_profile
orsource .bashrc
to apply the changes.Add SDK Tools to PATH: In addition to setting the
ANDROID_HOME
variable, you also need to add the Android SDK’stools
andplatform-tools
directories to your system’sPATH
variable.%ANDROID_HOME%tools
and%ANDROID_HOME%platform-tools
to thePATH
variable in the same "Environment Variables" window where you setANDROID_HOME
.Restart your terminal: After making changes to environment variables and
PATH
, close and reopen your terminal or command prompt for the changes to take effect.Run
flutter doctor --android-licenses
: Now, try runningflutter doctor --android-licenses
again in your terminal. It should successfully launch the Android SDK Manager and ask you to accept the licenses for various components.If you followed the steps correctly, the error "android sdk manager not found" should be resolved, and you should be able to accept the Android SDK licenses successfully.