user7693832
user7693832

Reputation: 6849

`flutter doctor` report error `Android toolchain - develop for Android devices`

I run flutter doctor in my Mac: there comes an issue below:

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14 18A391, locale
    zh-Hans-CN)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/setup/#android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, set
      ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

But I have installed Android SDK in my Mac this path /Users/delo/software/android-sdk-macosx.

before ask this question I have follow this post to add the /Users/delo/software/android-sdk-macosx in my /etc/paths.d/android-sdk file, and this post add path-to-android-sdk/tools and path-to-android-sdk/platform-tools.

but there is still have this issue.


EDIT-01

This is the echo $PATH:

/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/delo/.rvm/gems/ruby-2.3.3/bin:/Users/delo/.rvm/gems/ruby-2.3.3@global/bin:/Users/delo/.rvm/rubies/ruby-2.3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/delo/software/android-sdk-macosx:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/local/bin:/usr/local/mysql/bin:/usr/local/Cellar/go/1.7.6/bin:/Users/delo/.rvm/bin:/usr/local/sbin:/Users/delo/software/android-sdk-macosx/tools:/Users/delo/software/android-sdk-macosx/platform-tools

Upvotes: 1

Views: 3900

Answers (2)

Pegoraro
Pegoraro

Reputation: 1

I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.

Put the lines at the end of the .bachrc file:

export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"

Note that latest and 33.0.0 must be changed according to your installation.

Upvotes: 0

aircraft
aircraft

Reputation: 26886

I see your $PATH have add the ANDROID SDK PATH and its tools and platform-tools PATH, but did not config the flutter PATH, but you can still run flutter doctor command, there should be copy error.

in your case, there must be ANDROID_HOME variable config error,

you should follow the correct way :

append the

export PATH=/path/to/your/flutter/bin:$PATH
export ANDROID_HOME="/path/to/your/android-sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

to

then you just source ~/.bash_profile.

Upvotes: 1

Related Questions