Flutter医生报告看到安装了两个Android Studio

时间:2018-12-01 00:06:19

标签: android-studio flutter

为什么Flutter会在同一位置报告有效和无效的Android Studio安装?遇到的错误如下:

Sat Dec  1 10:52:34 AEDT 2018
flutter_app $ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.12, on Linux, locale en_AU.UTF-8)
• Flutter version 0.11.12 at /home/jedaa/bin/flutter
• Framework revision 06ec8d3b41 (2 days ago), 2018-11-28 15:56:58 -0800
• Engine revision 72c7a75672
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /home/jedaa/bin/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/jedaa/bin/Android/sdk
• Java binary at: /home/jedaa/bin/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.

[✓] Android Studio (version 3.2)
• Android Studio at /home/jedaa/bin/android-studio
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Android Studio
• Android Studio at /home/jedaa/bin/android-studio/
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• android-studio-dir = /home/jedaa/bin/android-studio/
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] IntelliJ IDEA Community Edition (version 2018.3)
• IntelliJ at /opt/idea
• Flutter plugin version 31.1.4
• Dart plugin version 183.4733

[✓] VS Code (version 1.29.1)
• VS Code at /usr/share/code
• Flutter extension version 2.21.0

[!] Connected device
! No devices available

当我加载AS并运行默认应用程序时..我在事件日志中得到了它:

10:51 AM    Unable to list devices: Unable to discover Android devices. 
Please run "flutter doctor" to diagnose potential issues

11:13 AM    Emulator: Couldn't statvfs() path: No such file or directory

11:13 AM    Emulator: qemu-system-x86_64: warning: host doesn't support 
requested feature: CPUID.80000001H:ECX.abm [bit 5]

Emulators are available

谢谢您能协助解决这个问题。

3 个答案:

答案 0 :(得分:1)

我建议清除android-studio-dir和android-sdk设置,然后让flutter自动检测其路径:

$ flutter config --android-studio-dir=""
Removing "android-studio-dir" value.

$ flutter config --android-sdk=""
Removing "android-sdk" value.

答案 1 :(得分:0)

以下两个flutter命令解决了该问题!!! ...

try{
horeca_medal = (ImageView)getApplicationContext().findViewById(R.id.horeca_medal);
//Write your own reference.

horeca_medal.setImageResource(R.drawable.first);

    if (pst <= 0) {
        horeca_medal.setImageResource(R.drawable.first);
    } else if (pst == 1) {
        horeca_medal.setImageResource(R.drawable.second);
    } else if (pst == 2) {
        horeca_medal.setImageResource(R.drawable.third);
    } else if (pst > 2 && pst < mTopHorecas.size()){
        horeca_medal.setVisibility(View.INVISIBLE); //This edit
    } else {
        horeca_medal.setImageResource(R.drawable.first);
    }
}catch(Excaption ex)
{
android.util.Log.e("YourError", ex.getMessage());
}

答案 2 :(得分:0)

删除包含Android Studio早期版本的配置文件的文件夹即可解决此问题。 更新后,我有2个版本的Android Studio。

.AndroidStudio3.3 
.AndroidStudio3.4

所以我删除了3.3(.AndroidStudio3.3)版本的配置文件,只保留了3.4(.AndroidStudio3.4)版本的配置文件

如果您是Ubuntu用户并且对Android Studio进行了默认安装,则可以在主目录中找到这些文件夹。这些文件夹是隐藏的,因此您必须先取消隐藏它们。

在更新后出现提示时,请确保导入先前的设置,否则在删除旧的配置文件之前,您将必须重新安装所有使用的依赖项。