找不到连接的设备。仿真器启动失败:无法通过提供的索引或标识符解析指定的已连​​接设备。

时间:2018-03-12 19:36:09

标签: nativescript

我正在学习NativeScript和 运行root时收到以下错误: 我按照这一步:

  1. 以管理员身份运行命令提示符。
  2. @powershell -NoProfile -ExecutionPolicy unrestricted -Command“iex((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))”&& SET PATH =%PATH%;%ALLUSERSPROFILE%\ chocolatey \ bin
  3. choco install googlechrome -y
  4. choco install nodejs-lts -y
  5. choco install jdk8 -y
  6. choco install android-sdk -y
  7. “%ANDROID_HOME%\ tools \ bin \ sdkmanager”“platform-tools”“平台; android-25”“build-tools; 25.0.2”“extras; android; m2repository”“extras; google; m2repository”< / LI>
  8. @powershell -NoProfile -ExecutionPolicy Bypass -Command“iex((new-object net.webclient).DownloadString('https://nativescript.org/setup/win-avd'))”
  9. choco install androidstudio -y
  10. npm i -g nativescript
  11. tns doctor我看到“没有发现问题”你很高兴去!
  12. tns创建HelloWorld --template nativescript-template-tutorial
  13. cd HelloWorld
  14. tns run android
  15. 错误: 找不到连接的设备。 仿真器启动失败:无法解析指定的连接设备  提供索引或标识符。列出当前连接的设备并验证 在指定的索引或标识符存在时,运行'tns device'。 列出当前连接的设备并验证指定的标识符exi sts,运行'tns device'。 要列出可用的仿真器映像,请运行'tns device --available-device S'。

3 个答案:

答案 0 :(得分:3)

首先,请确保您在命令行中位于$ ANDROID_HOME \ tools \ bin(默认路径为。\ Android \ android-sdk \ tools \ bin)。

使用sdkmanager安装软件包。

   sdkmanager “system-images;android-27;google_apis_playstore;x86”

要查看使用的SDK软件包列表

sdkmanager --list

如果收到“程序包路径无效。有效的系统映像路径是:ository”错误,请使用:

sdkmanager --licenses

然后通过使用

创建AVD
avdmanager create avd -n test -k "system-images;android-27;google_apis_playstore;x86"

答案 1 :(得分:2)

您可以查看可以下载的设备的所有包/图像 - avdmanager list。选择您需要的并安装:

cd $ANDROID_HOME/tools/bin

./sdkmanager "system-images;android-25;google_apis;x86"

./sdkmanager --licenses

创建图片:

avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"

如果你得到错误,我得到了:

  

.android / repositories.cfg无法加载

运行:

touch ~/.android/repositories.cfg

现在tns run android应该有效。

答案 2 :(得分:1)

如果要使用实际设备,则必须在开发人员选项中启用USB调试。之后,您可以看到tns device list-applications

列出的应用程序标识符