Android 讯息;颤振运行:无连接设备“;
我正在尝试创建一个带有颤振(全新安装)的示例应用程序。也已安装(新安装) 这是颤振运行的输出Android 讯息;颤振运行:无连接设备“;,android,android-studio,android-emulator,ios-simulator,flutter,Android,Android Studio,Android Emulator,Ios Simulator,Flutter,我正在尝试创建一个带有颤振(全新安装)的示例应用程序。也已安装(新安装) 这是颤振运行的输出 flutter run No connected devices. 颤振医生的输出: Doctor摘要(要查看所有详细信息,请运行flatter-Doctor-v): [✓] 颤振(通道测试版,v0.1.5,Linux上,语言环境en_US.UTF-8) [✓] Android工具链-为Android设备开发(Android SDK 27.0.3) [✓] Android Studio(3.0版) [
flutter run
No connected devices.
颤振医生的输出
:
Doctor摘要(要查看所有详细信息,请运行flatter-Doctor-v):
[✓] 颤振(通道测试版,v0.1.5,Linux上,语言环境en_US.UTF-8)
[✓] Android工具链-为Android设备开发(Android SDK 27.0.3)
[✓] Android Studio(3.0版)
[!]VS代码(版本1.20.1)
[!]连接的设备
!没有可用的设备
!医生发现了两类问题。
有解决此问题的方法吗?我遇到了与您相同的问题。结果是您的设备未与计算机连接 注:
- 如果您正在使用,如果您的计算机和设备都使用相同的Wi-Fi,则不必将设备与计算机连接
- 对于在终端命令下运行的Android或iOS,如果您使用命令行运行此命令,则必须确保它们通过电缆连接。共享同一Wi-Fi AP不起作用。请确保您的设备已真正连接。
- 确保您允许在Android设备上进行USB调试
flutter run --verbose
颤振支持iOS和Android设备/模拟器 在终端中,运行
flatter devices
命令,验证flatter是否识别您连接的Android设备。
下面是一份参考文档,介绍如何设置设备/模拟器来运行应用程序
对于
要准备在Android设备上运行和测试你的Flitter应用程序,你需要一台运行Android 4.1(API级别16)或更高版本的Android设备
flatter devices
命令以验证flatter是否识别您连接的Android设备flatter run
启动应用程序Android\u HOME
环境变量设置为该安装目录
要准备在Android emulator上运行和测试颤振应用程序,请执行以下步骤:
flatter run
启动应用程序。连接的设备名称为Android SDK,其平台为芯片系列,如x86- 如果您使用的是(Microsoft)Windows系统,下面是另一个文档:
应至少有一个设备/模拟器连接到运行应用程序 还要确保在开发人员设置中启用了USB调试。我用它运行了我的调试,可能是最适合Flitter的 设置不那么痛苦,但请确保在以下条件下设置ADB: 您的Andouird SDK路径
我的名字是C:\Users\user\AppData\Local\Android\Sdk。我面临着与flifter相同的问题。但我找到了另一种工作方式,即
flatter doctor
,并检查您的模拟器是否显示在“已连接的设备”标签下,例如
D:\flatterworkspace\flatter\u demo
颤振运行
命令。例如
请稍等片刻。您将看到您的应用程序在Android Emulator中运行
到目前为止,我还没有看到提到的一个选项是(对于我的设置),开发者选项“选择USB配置”必须设置为MTP(媒体传输协议)。对于Windows用户 为flatter SDK设置环境变量
PATH
(..\flatter\u windows\u v0.2.8-beta.zip\flatter\bin)
有关更多信息,您可以查看博客帖子
以下是上述页面的信息:
flutter emulators
将颤振添加到Windows环境变量PATH
:
C:\flatter\bin
)路径
变量并单击编辑
root@abc-OptiPlex-3050:~/flutter_workspace/my_app/my_app# flutter run
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
Using hardware rendering with device Android SDK built for x86.
If you get graphics artifacts, consider enabling software rendering
with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... 1.2s
Running 'gradlew assembleDebug'... 1.5s
Built build/app/outputs/apk/debug/app-debug.apk.
I/FlutterActivityDelegate(25096): onResume setting current activity to this
Syncing files to device Android SDK built for x86...
D/ (25096): HostConnection::get() New Host Connection established
0xe8487780, tid 25116
D/EGL_emulation(25096): eglMakeCurrent: 0xe5b3d8a0: ver 2 0 (tinfo 0xe84832f0)
The actual answer did not work for me.
But setting ANDROID_HOME
in your ~/.bash_profile
file, logging out, and then logging in, makes it work!
This may be an Android Studio issue since it is not setting this environment variable for the open projects.For Windows users,
The solution for me was running Android Studio as administratorNone of the above solutions worked for me, but I was able to solve it by invalidating catch
and restarting my Android Studio:
Menu File → Invalidate Catches / Restart...
EDIT:::
To clear Android Studio’s cache and bring it out of its state of confusion
select ‘File > Invalidate Caches / Restart’ and then click the ‘Invalidate and Restart’ button.
Clean and rebuild your project.This was my solution:
My "Developer Options" was ON, but the "USB Debugging" was OFF.
So I turned ON the USB Debugging and the problem was solved.It basically needs a device "connected" to your development machine. If you're using a simulator/emulator running on the machine it should automatically be recognised as a connected device. Another way is to connect a physical device and the setup process varies slightly for Android and iOS devices.For me it was
- adding "ANDROID_HOME" to the Environment variables and setting it to
D:\dev\android\
(for me)
- adding "D:\dev\android\platform-tools" (for me) to environment variable PATH. I put flutter there before
- OK, OK, OK. Restart Android Studio
What I needed to do:
flutter emulators
flutter emulators --launch EMULATOR NAME
flutter run -d "EMULATOR ID"
flutter config --android-sdk ANDROID_SDK_PATH
flutter config --android-sdk C:\Users\%youruser%\AppData\Local\Android\Sdk
export ANDROID_SDK_ROOT="~/Library/Android/sdk"
export ANDROID_SDK_ROOT="/Users/charliema/Library/Android/sdk"
flutter devices
flutter config --android-sdk ANDROID_SDK_PATH
<ANDROID_SDK_HOME>\platform-tools>adb devices
List of devices attached
4df798d76f98cf6d unauthorized
adb kill-server
adb start-server
flutter emulators