我正在运行Arch Linux。
我遇到了一个问题,flutter doctor
无法识别我的Android Sdk。
我的长笛医生输出:
[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, 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.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[✓] Android Studio
[!] Connected device
! No devices available
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
以下是更详细的总结:
[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
• Flutter version 2.10.3 at /home/tt/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✗] 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/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
• Android Studio at /home/tt/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401
• Flutter plugin version 65.2.2
• Dart plugin version 211.7808
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] Android Studio
• Android Studio at /opt/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.11+0-b60-7590822)
[!] Connected device
! No devices available
[✓] HTTP Host Availability
• All required HTTP hosts are available
正如你所看到的,它无法识别我的Android Sdk。我试过这个:
flutter config --android-sdk /home/tt/Android/Sdk/platforms/android-32/android.jar
我得到了:
Setting "android-sdk" value to "/home/tt/Android/Sdk/platforms/android-32/android.jar".
You may need to restart any open editors for them to read new settings.
我运行了flutter doctor
,但没有工作。我重新启动了我的机器,但它仍然不工作。
我已经从工具箱应用程序中获得了Android Studio。我尝试从.tar.gz
版本安装它。仍然不起作用。我从AUR安装,但什么都不起作用。
你能帮忙吗。。
尝试在环境变量中设置ANDROID_HOME。
在你使用bash的~/.bashrc或~/.zshrc上,如果你在最后一行使用zsh,请放入
export ANDROID_HOME=[SDK-PATH]
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
我认为问题出在Android SDK命令行工具和Android SDK构建工具的PATH中。
将以下行放在~/.bachrc文件的末尾:
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/"
请注意,XXX、最新和33.0.0必须根据您的安装进行更改。