Flutter Android Studio extension doesn't seem to respect exports from my shell. I'm using zsh (oh-my-zsh) on Manjaro linux.
When I execute flutter doctor from Android Studio I get this:
/run/media/storage/flutter/bin/flutter --no-color doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.2.8, on Linux, locale en_US.UTF-8)
[✗] 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.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] Android Studio (version 3.1)
! Doctor found issues in 2 categories.
Process finished with exit code 0
But on the console I get this
[✓] Flutter (Channel beta, v0.2.8, on Linux, locale en_US.UTF-8)
• Flutter version 0.2.8 at /run/media/storage/flutter
• Framework revision b397406561 (11 days ago), 2018-04-02 13:53:20 -0700
• Engine revision c903c217a1
• Dart version 2.0.0-dev.43.0.flutter-52afcba357
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
• Android SDK at /run/media/storage/android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-26, build-tools 26.0.2
• ANDROID_HOME = /run/media/storage/android-sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.1)
• Android Studio at /opt/android-studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] Connected devices (1 available)
• SM G925K • 03157df3db30c710 • android-arm64 • Android 5.1.1 (API 22)
Resetting Android Studio doesn't help.
How can I at least work around this to add ANDROID_HOME properly to flutter plugin?
It looks like a similar issue was being discussed in https://github.com/flutter/flutter/issues/15114. The blog post mentioned may come in handy...
https://blog.gauravagarwalr.com/posts/2018-04-11-setting-up-flutter/
cc @stevemessick
I've already seen this blog post while trying to get this working and I have both ANDROID_HOME and ANDROID_SDK_ROOT set.
And the doctor works in the console so it can see them. The problem must be somewhere where the shell environment is created. I see that @binary132 is also using .zsh, mayby it has something to do with it?
I just use exports in my ~/.zshrc
export ANDROID_HOME=/run/media/storage/android-sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
Mine is the similar problem. Flutter on the command line (Ubuntu 16.04 LTS, Bash) works just fine with $ANDROID_HOME being set into ~/.bashrc
The following is the output on the command line for flutter doctor.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.4.4, on Linux, locale en_AU.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.0)
[✗] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[!] Connected devices
! No devices available! Doctor found issues in 2 categories.
I actually am not interested in Android Studio being setup as I already use IntelliJ. But from within IntelliJ, flutter doctor gives following.
[✓] Flutter (Channel beta, v0.4.4, on Linux, locale en_AU.UTF-8)
[✗] 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.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✗] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[✓] Connected devices (1 available)! Doctor found issues in 2 categories.
Basically, another victim of the issue being discussed here : Flutter plugin not respecting $ANDROID_HOME set in the command line.
note: I also have $ANDROID_SDK_ROOT set to the same path but that as well does not help.
ps: also a thing to note is - the intellij instance of flutter doctor has one connected device detected whereas the command line instance did not. Definitely doesn't looks like an issue with the plugin itself but strange to the eyes.
@damienix, perhaps the way you launched Android Studio didn't inherit the variables set in your shell's rc file. If you launch it from a shell session, do you get the expected behavior?
Bingo, that helps :) :+1:
Ok. That's a different issue than https://github.com/flutter/flutter/issues/15114. Glad I could help though!
Most helpful comment
@damienix, perhaps the way you launched Android Studio didn't inherit the variables set in your shell's rc file. If you launch it from a shell session, do you get the expected behavior?