当我运行flutter doctor
时
我收到以下消息:我也无法运行flutter run
,因为它找不到正在运行的模拟器。
❯ flutter doctor -v
[✓] Flutter (Channel beta, 1.20.2, on Linux, locale en_US.UTF-8)
• Flutter version 1.20.2 at
/home/ajinkya/snap/flutter/common/flutter
• Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09
-0700
• Engine revision 9d5b21729f
• Dart version 2.9.1
[!] Android toolchain - develop for Android devices (Android SDK version
30.0.2)
• Android SDK at /home/ajinkya/Android/Sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build
11.0.8+10-post-Ubuntu-0ubuntu120.04)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit
https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions.
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit
https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions).
Scanning for devices is taking a long time...⣽
但是我已经全部安装了
答案 0 :(得分:0)
问题出在多个JAVA版本期间。且未设置正确的PATH。
即使从sudo update-alternatives --config java
设置了正确的版本,也不会设置JAVA版本。
输入javac -version
将打印版本11。
像下面的export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
#export JAVA_HOME=/usr/lib/jvm/default-java
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH="/usr/lib/dart/bin:$PATH"
然后这将打印正确:
❯ javac -version
javac 1.8.0_265