简体   繁体   English

Android Studio(未安装),当运行 flutter doctor 而 Android Studio 安装在机器上时

[英]Android Studio (not installed) , when run flutter doctor while Android Studio installed on machine

When I run flutter doctor command on mac its showing below, while I already install Android Studio, and I can run ios build from Android Studio.当我在 mac 上运行 flutter doctor 命令时,它显示如下,而我已经安装了 Android Studio,并且我可以从 Android Studio 运行 ios build。

[!] Android Studio (not installed) [!] Android Studio(未安装)

flutter doctor output: flutter 医生 output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.5 18F132, locale en-GB)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[!] Android Studio (not installed)
[✓] Connected device (1 available)

In Windows在 Windows 中


if your Android Studio install by default, you can use this command如果你的 Android Studio 默认安装,你可以使用这个命令

flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"

after this command, flutter can found android studio, but the plugin can't...这个命令之后,flutter可以找到android studio,但是插件找不到...

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.48.0)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

In Linux (Ubuntu)在 Linux (Ubuntu) 中


Note: for those who are facing the problem in Ubuntu and Android Studio is installed with snap :注意:对于那些在 Ubuntu 中遇到问题的人,Android Studio 安装了snap

flutter config --android-studio-dir="/snap/android-studio/current/android-studio"

Note: for those who are facing the problem in Ubuntu and Android Studio is installed with JetBrains Toolbox:注意:对于那些在 Ubuntu 和 Android Studio 中安装 JetBrains Toolbox 时遇到问题的人:

flutter config --android-studio-dir=/home/myuser/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882

Where ./201.7042822 matches the current version of Android Studio installed.其中./201.7042822与当前安装的 Android Studio 版本匹配。 You'll have to check which one you have and update it in the command above.您必须检查您拥有哪一个并在上面的命令中更新它。

I had a similar issue which I solved by updating my flutter config as follows:我有一个类似的问题,我通过如下更新我的颤振配置解决了这个问题:

  flutter config --android-sdk="$HOME/Android/Sdk"
  flutter config --android-studio-dir="/usr/local/android-studio"

This was on Ubuntu 20.04.1这是在 Ubuntu 20.04.1 上

Assumptions:假设:

  • You have extracted the downloaded android studio zip to /usr/local/android-studio您已将下载的 android studio zip 解压到/usr/local/android-studio

If you install Android studio using snap then如果您使用snap安装 Android Studio,那么

flutter config --android-studio-dir="/snap/android-studio/current/android-studio"

I solve this issue within windows 10 pro with this exactly line:我在 Windows 10 pro 中用这条线解决了这个问题:

$> flutter config --android-studio-dir= "C:\Program Files\Android\Android Studio"

notice that is an space between the equal mark and the double cotes, this solve as you can see in this print请注意,这是等号和双引号之间的一个空格,正如您在此打印中看到的那样,这解决了显示立即解决! 这是没有完全格式化的失败尝试

hope this help new flutter developers!希望这对新的颤振开发人员有所帮助!

If you have installed Android Studio via Snap, run following command如果您通过 Snap 安装了 Android Studio,请运行以下命令

flutter config --android-studio-dir="/snap/android-studio/current/android-studio"

This will fix the issue这将解决问题

flutter config --android-studio-dir C:\Program Files\Android\Android Studio将无法工作,因为空白空间会破坏树结构,但要解决问题,请使用如下引号: flutter config --android-studio-dir "C:\Program Files\Android\Android Studio"

A solution that worked for me was (after double clicking the downloaded file IDE) move the Android Studio program into the applications folder.一个对我有用的解决方案是(在双击下载的文件 IDE 之后)将 Android Studio 程序移动到应用程序文件夹中。

I ran Flutter Doctor and followed all prompts.我运行了 Flutter Doctor 并按照所有提示进行操作。 worked for me.为我工作。

This works on MacOS only这仅适用于 MacOS

I think that I had the same issue, below are steps that helped me so I would recommend to try them.我认为我遇到了同样的问题,以下是对我有帮助的步骤,因此我建议您尝试一下。
1. Android Studio is installed and you can run it, so when it boots up, select configure: 1. Android Studio 安装好了,可以运行了,所以在启动的时候,选择configure: 在 Android Studio 屏幕上哪里可以找到配置

  1. In dropdown list open "plugins"在下拉列表中打开“插件”
  2. Search for "flutter" and install this plugin together with dart.搜索“flutter”并将此插件与 dart 一起安装。
  3. Restart the Android Studio and open a new terminal.重新启动 Android Studio 并打开一个新终端。
  4. You should be able to create a flutter project in Android Studio and "flutter doctor" should work now.您应该能够在 Android Studio 中创建一个颤振项目,并且“颤振医生”现在应该可以工作了。

Another possible solution:另一种可能的解决方案:
Specify path, where android studio is installed, with the following command:使用以下命令指定安装 android studio 的路径:
flutter config --android-studio-dir=颤振配置--android-studio-dir=

This worked for me!!这对我有用!

The problem is if your folder name is "Android Studio", flutter is not able to detect it later as taking only Android and skipping Studio.问题是如果您的文件夹名称是“Android Studio”,flutter 以后无法检测到它,因为它只使用了 Android 并跳过了 Studio。

Solution is :解决方案是:

Rename folder name from "Android Studio" To "AndroidStudio" and then run the config command :将文件夹名称从“Android Studio”重命名为“AndroidStudio”,然后运行配置命令:

flutter config --android-studio-dir="C:\Program Files\Android\AndroidStudio"颤振配置 --android-studio-dir="C:\Program Files\Android\AndroidStudio" 在此处输入图像描述

Following worked for me.以下为我工作。

Close opened Android studio application if any, and open the cmd as an admisitrator and give the below command关闭已打开的 Android Studio 应用程序(如果有),并以管理员身份打开 cmd 并给出以下命令

flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"

For ubuntu;对于Ubuntu; in the unzip directory;在解压缩目录中;

flutter config --android-studio-dir=" pwd /android-studio"颤振配置 --android-studio-dir=" pwd /android-studio"

command work for me.命令为我工作。

  1. Go Android studio Home Screen转到 Android 工作室主屏幕
  2. Configure配置
  3. Install Flutter, Dart, Plugin安装 Flutter、Dart、插件
  4. Restart android studio and work properly重启android studio并正常工作

if now you are not able to solve the issue so please run this command and check again如果现在您无法解决问题,请运行此命令并再次检查

C:\mycomputer>flutter config --android-studio-dir="C:\ProgramFiles\Android\Android Studio"

I Have Solve this issue with this command我已经用这个命令解决了这个问题

在此处输入图像描述

This works for me in windows 8.1:这在 Windows 8.1 中对我有用:

flutter config --android-studio-dir "C:\Program Files\Android\Android Studio"

2021.09.01 2021.09.01

You can use below command in command prompt您可以在命令提示符下使用以下命令

flutter config --android-studio-dir=""颤振配置 --android-studio-dir=""

The solution with : flutter config --android-studio-dir="Your_Android_Studio_Directory" worked for me.解决方案:flutter config --android-studio-dir="Your_Android_Studio_Directory" 对我有用。

After that you can get error messages with flutter doctor even if you have the pluggins already intalled:之后,即使您已经安装了插件,您也可以使用颤振医生收到错误消息:

[!] Android Studio X Flutter plugin not installed; [!] Android Studio X Flutter 插件未安装; this adds Flutter specific functionality.这增加了 Flutter 特定的功能。 X Dart plugin not installed; X Dart 插件未安装; this adds Dart specific functionality.这增加了 Dart 特定的功能。

Reinstalling flutter and dart plugins in Android Studio (version 4.1) solved the problem.在 Android Studio(4.1 版)中重新安装颤振和飞镖插件解决了这个问题。

Even though this question is for mac, a lot of people like me will find this as top result.尽管这个问题是针对 mac 的,但很多像我这样的人会发现这是最好的结果。 So in case you are on Windows and you installed Android Studio via JetBrains Toolchain and the paths in answers above don't work for you, this worked for me因此,如果您在 Windows 上并且您通过 JetBrains Toolchain 安装了 Android Studio,并且上面答案中的路径对您不起作用,这对我有用

flutter config --android-studio-dir="C:\Users\YOUR_USERNAME_HERE\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\202.7351085"

Where 202.7351085 is the folder name for my current version of Android Studio so you may need to change that too.其中 202.7351085 是我当前版本的 Android Studio 的文件夹名称,因此您可能也需要更改它。

If you can't find Android Studio in this path, do:如果在此路径中找不到 Android Studio,请执行以下操作:

  1. Search Android Studio and open file location搜索 Android Studio 并打开文件位置
  2. If it's a shortcut, open location again如果是快捷方式,请再次打开位置
  3. You should be in /bin你应该在 /bin
  4. Go up one folder and that's your path上一个文件夹,这就是你的路径

Run

flutter config --android-studio-dir=<directory-where-studio-is-installed>  

This will solve both issues of android licenses and studio not installed这将解决 android 许可证和未安装工作室的问题

For Linux (Ubuntu) users对于 Linux (Ubuntu) 用户

  1. Run

if you installed android studio through snap (Ubuntu Software application), run如果您通过 snap(Ubuntu 软件应用程序)安装了 android studio,请运行

flutter config --android-studio-dir="/snap/android-studio/current/android-studio"

Otherwise, run否则,运行

flutter config --android-sdk="$HOME/Android/Sdk"
flutter config --android-studio-dir="/usr/local/android-studio"
  1. Install Dart and Flutter plugins in Android Studio and then Restart在 Android Studio 中安装 Dart 和 Flutter 插件然后重启
  2. Switch to Flutter Beta Channel by running these commands通过运行这些命令切换到 Flutter Beta 通道

flutter channel beta颤振通道测试版

flutter upgrade颤振升级

Run flutter doctorflutter doctor

The solution that worked for me is that I had to re-install AndroidStudio to a new location in a way that the full path to it contains no spaces, in the image below will you notice that flutter was cropping my full path because it contained a white space when I use the command flutter config --android-studio-dir C:\Program Files\Android\Android Studio对我有用的解决方案是我必须以完整路径不包含空格的方式将 AndroidStudio 重新安装到新位置,在下图中,您会注意到颤动正在裁剪我的完整路径,因为它包含一个当我使用命令flutter config --android-studio-dir C:\Program Files\Android\Android Studio时出现空白

在此处输入图像描述

I had this problem because I downloaded a new AS version without uninstalling the old one first.我遇到了这个问题,因为我没有先卸载旧版本就下载了新的 AS 版本。 During the download AS left the old program in place at C:\Program Files\Android\Android Studio and just created a new installation at C:\Program Files\Android\Android Studio1 (two installations next to each other??!! ).在下载过程中,AS 将旧程序保留在C:\Program Files\Android\Android Studio并刚刚在C:\Program Files\Android\Android Studio1创建了一个新安装(两个安装相邻??!!) .

I tried uninstalling AS (so I could do a fresh install) using the windows control panel but it said AS is already uninstalled?我尝试使用 Windows 控制面板卸载 AS(所以我可以进行全新安装),但它说 AS 已经卸载?

So I had to run flutter config --android-studio-dir="C:\Program Files\Android\Android Studio1" to point to the new version ie Android Studio1.所以我不得不运行flutter config --android-studio-dir="C:\Program Files\Android\Android Studio1"来指向新版本,即Android Studio1。 This solved the problem.这解决了问题。

In my case just renamed from AndroidStudio to Android Studio.app inside app folder cuz it was searching for separated words: Android Studio.就我而言,只是在应用文件夹中从 AndroidStudio 重命名为 Android Studio.app,因为它正在搜索分隔词:Android Studio。 Worked like a charm像魅力一样工作

I faced the same problem and solved by configuring android studio path manually.我遇到了同样的问题,并通过手动配置 android studio 路径来解决。 For my case the path was /opt/android-studio-4.1/android-studio就我而言,路径是/opt/android-studio-4.1/android-studio

flutter config --android-studio-dir=/opt/android-studio-4.1/android-studio

在 windows 上,只需在环境变量中添加路径 C:\Program Files\Android\Android Studio

Following worked for me in Windows:以下在 Windows 中为我工作:

flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"

flutter config --android-sdk="C:\%HOMEPATH%\AppData\Local\Android\Sdk"

I use WSL on Windows 10 and I think that I was configuring flutter from WSL's command prompt.我在 Windows 10 上使用 WSL,我认为我是从 WSL 的命令提示符配置颤振。 When I cleaned the flutter repo and tried to configure everything from PowerShell as administrator, it worked.当我清理颤振存储库并尝试以管理员身份从 PowerShell 配置所有内容时,它起作用了。

On MacOS using Jetbrains Toolbox, I set it up as在使用 Jetbrains Toolbox 的 MacOS 上,我将其设置为

flutter config --android-studio-dir "/Users/<myusername>/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app"

flutter config --android-studio-dir="file path of android studio" flutter config --android-studio-dir="android studio的文件路径"

for example : in my case, my android studio in "E Drive "例如:就我而言,我在“E Drive”中的 android studio

flutter config --android-studio-dir="E:\Android\Android Studio"颤振配置 --android-studio-dir="E:\Android\Android Studio"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM