Android Studio未安装[Linux] pop os 20.04

时间:2020-09-02 04:21:17

标签: android android-studio flutter

当我运行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...⣽

但是我已经全部安装了

enter image description here

1 个答案:

答案 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