NativeScript - 仿真设备无法访问/设备未经授权

时间:2018-03-20 17:54:49

标签: android nativescript

我正在尝试使用虚拟Android设备让NativeScript在我的机器上运行。我在linux(ubuntu 16)机器上。

我遵循了installation guide

我能够使用Android Studio的AVD Manager启动虚拟设备。在启动的虚拟设备上,我激活了开发人员选项并启用了USB调试。

运行tns doctor会产生:

$ tns doctor
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.

Your components are up-to-date: 
nativescript,tns-core-modules,tns-android,tns-ios

No issues were detected.

之后我使用tns create HelloWorld --template nativescript-template-ng-tutorial创建了HelloWorldAPP,效果很好。但是当我尝试启动APP时,我得到了:

$ tns run android 
Searching for devices...
Skipping prepare.
Unable to apply changes on device: emulator-5554. Error is: The device is not authorized. Please use the --emulator flag to run the application on on an emulator.

我看过我可以像这样查看我的设备的状态:

$ tns devices

Connected devices & emulators
Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
┌───┬─────────────┬──────────┬───────────────────┬────────┬─────────────┐
│ # │ Device Name │ Platform │ Device Identifier │ Type   │ Status      │
│ 1 │             │ Android  │ emulator-5554     │ Device │ Unreachable │

到目前为止,我在寻找解决方案的所有内容都与真正的设备相关(如使用USB 2.0而不是3.0)或使用不同的操作系统,因此我发现的“修复”不适用。

感谢您的时间!

Raphael Hippe

2 个答案:

答案 0 :(得分:0)

这似乎是虚拟设备“Nexus”的问题。我设法使用带有API v27补丁的Pixel2使HelloWorldApp工作。

干杯,

Raphael Hippe

答案 1 :(得分:0)

尝试以下步骤:

  1. 确保您拥有完整的管理员权限。
  2. 尝试以管理员身份启动命令提示符,因为节点和本机脚本需要正常运行。
  3. 在创建模拟器时,尝试使用Google API作为API级别部分。
  4. 尝试在管理员模式下启动Android SDK管理器,然后尝试启动模拟器。
  5. 希望这可以解决您的问题。

相关问题