尝试使用ionic cordova运行的android--设备时未找到设备/模拟器

尝试使用ionic cordova运行的android--设备时未找到设备/模拟器,android,ionic-framework,native,ionic-native,Android,Ionic Framework,Native,Ionic Native,连接的设备: 它正在运行启用USB调试的开发人员选项 它使用MTP作为设备文件管理器 驱动程序已经安装到笔记本电脑上,没有任何问题,我可以很好地浏览文件 当我运行时:ionic cordova run android--device我得到以下输出: BUILD SUCCESSFUL in 5s 42 actionable tasks: 42 up-to-date Built the following apk(s): C:\Users\K-PC\myApp\platforms\

连接的设备:

  • 它正在运行启用USB调试的开发人员选项

  • 它使用MTP作为设备文件管理器

  • 驱动程序已经安装到笔记本电脑上,没有任何问题,我可以很好地浏览文件

当我运行时:
ionic cordova run android--device
我得到以下输出:

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.
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
我检查设备是否使用
原生运行android--list
列出,我得到以下输出:

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.
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
我安装了Android Studio,我的AVD管理器中有两个虚拟设备:

我想将APK部署到连接到笔记本电脑的设备上,而不是这些模拟器,但奇怪的是,它甚至没有在我的AVD管理器中识别出模拟器


如何解决此问题?我希望我已经给出了足够的细节。

使用ADB

adb devices
该命令应提供所连接设备的列表。您必须在手机上接受调试模式。在尝试使用硬件设备运行应用程序之前,您应该检查adb是否至少与一个设备连接。可能会出现以下问题:

  • 设备列表为空:这意味着设备未正确连接或USB电缆有问题(可能损坏)
  • 未经授权:未接受手机调试授权时出现
  • 离线:手机有一个名为守护进程的小服务,它可以与计算机连接,以便传输文件和收听更改。此服务未运行时,将停止与计算机的连接。可以通过重新启动设备或连接/断开USB电缆直到显示为“在线”来解决此问题
  • 总之,您应该运行以下代码:

  • 在Android设备上启用调试模式。还可以启用同一配置视图中的USB调试
  • 运行adb设备,授权与计算机连接。解决上面已经评论过的问题(,如果有)
  • 运行ionic cordova运行android--设备
  • 编码时间快乐
    没有显示任何内容,这使我意识到USB调试未正确启用。我在插入设备之前启用了它,这不允许我将设备添加为受信任的计算机。谢谢你的推动!