[英]no devices/emulators found when trying to use ionic cordova run android --device
The Connected Device:连接的设备:
It is running Developer Options with USB debugging enabled它正在运行开发人员选项并启用 USB 调试
It is using MTP as the Device file manager它使用 MTP 作为设备文件管理器
Drivers have been installed to the laptop with no issues and I can browse the files fine驱动程序已安装到笔记本电脑上,没有任何问题,我可以正常浏览文件
When I run: ionic cordova run android --device
I get this output:当我运行:
ionic cordova run android --device
我得到这个 output:
BUILD SUCCESSFUL in 5s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\Users\K-PC\myApp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --device
[native-run] ERR_NO_DEVICE: No hardware devices found. Not attempting emulator because --device was specified.
[native-run]
[native-run] More details for this error may be available online:
[native-run]
[native-run] https://github.com/ionic-team/native-run/wiki/Android-Errors
[ERROR] An error occurred while running subprocess native-run.
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I checked to see if the device was listed using native-run android --list
and I get this output:我检查了设备是否使用
native-run android --list
列出,我得到了这个 output:
Errors (!):
ERR_UNSUITABLE_API_INSTALLATION: No suitable API installation found.
More details for this error may be available online:
https://github.com/ionic-team/native-run/wiki/Android-Errors
Connected Devices:
No connected devices found
Virtual Devices:
No virtual devices found
I have Android Studio installed, I have two virtual devices in my AVD manager:我安装了 Android Studio,我的 AVD 管理器中有两个虚拟设备:
I want to deploy the APK onto the device connected to my laptop, not these emulators but its strange to see that it hasn't even recognised the emulators inside my AVD manager我想将 APK 部署到连接到我的笔记本电脑的设备上,而不是这些模拟器,但奇怪的是它甚至没有识别我的 AVD 管理器中的模拟器
How can I fix this issue?我该如何解决这个问题? I hope I have given enough detail.
我希望我已经提供了足够的细节。
Using ADB使用亚行
adb devices
That command should give you a list of the attached devices.该命令应该为您提供连接设备的列表。 You must accept the debug mode on the phone.
您必须接受手机上的调试模式。 Before trying to run the app with a hardware device you should check that adb has a connection with one device atleast.Some issues may appear like:
在尝试使用硬件设备运行应用程序之前,您应该检查adb是否至少与一台设备连接。一些问题可能如下所示:
In summary you should run this code:总之,您应该运行以下代码:
adb devices
, Authorize to connect with the computer.adb devices
,授权与电脑连接。 Solve the issues( if there's any ) already commented above.ionic cordova run android --device
.ionic cordova run android --device
。I'm having the same problem.我有同样的问题。
I can solve this with this: Ionic forum .我可以用这个解决这个问题: Ionic forum 。
In the case that the command adb devices
return a list of devices and emulators, but the command ionic cap run android --list
not recognize these, the problem could be that required environment vars ANDROID_SDK_ROOT
and ANDROID_HOME
are not set.如果命令
adb devices
返回设备和模拟器列表,但命令ionic cap run android --list
无法识别这些,问题可能是所需的环境变量ANDROID_SDK_ROOT
和ANDROID_HOME
未设置。
$ adb devices
List of devices attached
817460470221 device
emulator-5554 device
$ ionic cap run android --list
[INFO] No native targets found.
To set this vars first found the android sdk location, for this you can go to android-studio and in the menu Tools > SDK Manager , search the section call Android Location
, export both vars in the shell instance used to run the ionic
commands. To set this vars first found the android sdk location, for this you can go to android-studio and in the menu Tools > SDK Manager , search the section call
Android Location
, export both vars in the shell instance used to run the ionic
commands.
In my case i do this就我而言,我这样做
export ANDROID_SDK_ROOT="/home/myhome/Android/Sdk"
export ANDROID_HOME="/myhome/myhome/Android/Sdk"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.