I was running with the same problem when I was trying the flutter doctor
command:
The problem is a little clear, it’s occurring because the flutter is not founding the path for your Android SDK.
There are two ways to solve it:
-
You can solve this issue setting only for your current terminal instance the SDK path with the following commands:
flutter config --android-sdk /path/to/android/sdk
flutter config --android-studio-dir /path/to/android/studio
-
Or to save it forever, exporting the
ANDROID_HOME
with your Android sdk path.
I solved it by exporting the ANDROID_HOME
on my machine (Arch Linux, but this works for any Unix instance).
This will solve your issue, But you can need the sdk
, platform-tools
, tools
and the ndk-build
paths too (of course, everything needs to be installed first) on my profile file (in my case the .zshrc
file, the same can be done on your .bashrc
and etc.):
#SDK exporting - this will solve your issue
export ANDROID_HOME=/home/{user}/Android/Sdk
#Tools exporting - it can be need in your case
export PATH=/home/{user}/Android/Sdk/platform-tools:$PATH
export PATH=/home/{user}/Android/Sdk/tools:$PATH
export PATH=/home/{user}/Android/ndk-build:$PATH
#Flutter binary exporting
export PATH=/home/{user}/flutter/bin:$PATH
Then, I reloaded my profile file (that in my is the .zshrc
file, use your file in your case .eg .bashrc
):
source ~/.zshrc
After that, the flutter doctor
will run properly.