0

我有一个使用VS代码开发的Nativescript应用程序,当我尝试使用Nativescript扩展的Nativescript启动配置运行它时没有任何问题,当我使用真实设备与USB连接或当我使用其中一个android-sdk模拟器时。使用Visual Studio模拟器运行的Nativescript项目

现在我还需要在机器上运行Hyper-V,并且当虚拟机管理程序打开时这些模拟器无法运行。所以我下载并安装了Visual Studio Android Emulator,当我手动启动它时,它运行良好。

问题是nativescript项目不能识别这个设备,或者使用tns设备或adb设备命令,如果我尝试从VS Code启动应用程序,它会尝试启动其他模拟器之一,这显然会失败,因为管理程序/ Intel Haax不兼容。

你们之前是否有过这个问题,并且有可以分享的解决方案?

谢谢。

回答

2

微软MSDN说:

如果模拟器运行,但它不会出现连接到ADB或者它不会出现在Android的工具,利用亚行(for example, Android Studio or Eclipse)的,你可能需要调整模拟器寻找ADB。

仿真器使用注册表项识别您的Android SDK的基础位置,并寻找\平台TOOLS \这个目录下adb.exe文件。


这里我们去!分步实施;)

复制您的ANDROID SDK PATH对我来说是这样的:

enter image description here


要修改仿真器使用Android SDK的路径:

  1. 开放注册表编辑器通过从“开始”按钮上下文菜单中选择“运行”,键入regedit在对话框中,然后选择确定。

enter image description here


  • 导航到HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools在左侧的文件夹树。
  • 注:如果Android SDK Tools文件夹不存在,创建它WOW6432Node下,然后打开它,并创建一个String Value命名Path :)

  • 修改Path注册表变量以匹配到您的路径Android SDK
  • enter image description here


  • 重新启动仿真器和你现在应该能够看到连接到ADB和相关Android工具仿真器。
  • enter image description here


    现在!打开你的终端(CMD),并运行ADB命令

    adb devices -l

    enter image description here

    YES YES! Visual Studio模拟器正在运行,并连接到ADB!


    HERE WE GOO!

    现在我们要创建一个演示应用(例如FIRSTZAKI)ZAKI是我的小名:对

    在终端(CMD):

    tns create FIRSTZAKI

    enter image description here

    选择Android平台

    cd FIRSTZAKI\

    tns platform add android

    enter image description here

    检查VS仿真器是准备好了!

    tns devices

    enter image description here

    YES YES ^^

    最后步骤(RUN/BUILD)

    tns run android

    enter image description here

    WOW ...大:)

    enter image description here

    和..好运♥ - ZAKI

    +0

    你是有点神了! – teliaz

    +0

    对不起^^!你是什​​么意思 –

    +0

    你节省了我很多时间搜索如何正确设置Visual Studio模拟器......不错的工作 – teliaz

    相关问题