使用Visual Studio模拟器运行的Nativescript项目 [英] Nativescript project running with Visual Studio Emulator

查看:252
本文介绍了使用Visual Studio模拟器运行的Nativescript项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在使用VS Code开发的Nativescript应用程序,当我尝试使用Nativescript扩展中的Nativescript启动配置运行该应用程序时,当我使用连接USB的真实设备时,或者当我使用其中一种android-sdk模拟器.

现在,我也需要在计算机上运行Hyper-V,并且在打开虚拟机监控程序时,这些仿真器将无法运行.因此,我下载并安装了Visual Studio Android模拟器,当我手动启动它时,它运行良好.

问题是本机脚本项目无法使用tns设备或adb设备命令识别此设备,并且如果我尝试从VS Code启动该应用程序,它将尝试启动其他仿真器之一,这显然由于系统管理程序/英特尔Haax不兼容.

你们中的任何人以前有过这个问题吗,并且可以分享任何解决方案?

谢谢.

解决方案

Microsoft MSDN说:

如果仿真器正在运行,但似乎未连接到ADB ,或者在使用ADB (for example, Android Studio or Eclipse)的Android工具中未出现,则可能需要调整仿真器的位置模拟器寻找ADB.

模拟器使用 注册表项 来标识Android SDK的基本位置,然后查找 该目录下的\ platform-tools \ adb.exe 文件.


我们来了!!循序渐进;)

为我复制您的ANDROID SDK PATH,就像这样:


要修改模拟器使用的Android SDK路径,请执行以下操作:

  1. 打开注册表编辑器,方法是从开始"按钮上下文菜单中选择运行",在对话框中键入 regedit ,然后选择确定".


  1. 在左侧的文件夹树中导航至 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools .

注意:如果Android SDK Tools文件夹不存在,请在WOW6432Node下创建它,然后打开它,并创建一个String Value命名为Path:)

  1. 修改 Path 注册表变量以匹配 Android SDK 的路径.


  1. 重新启动仿真器,您现在应该可以看到仿真器已连接到ADB和关联的Android工具.


现在!打开您的终端(CMD),然后运行ADB命令

adb devices -l

是是!! Visual Studio仿真器正在运行,并已连接到ADB!


HERE WE GOO !!

现在我们要创建一个演示应用程序(例如FIRSTZAKI) ZAKI是我的昵称:p

在终端(CMD)上:

tns create FIRSTZAKI

选择Android平台

cd FIRSTZAKI\

tns platform add android

检查VS仿真器是否准备就绪!

tns devices

是是^^

最后一步(运行/构建):

tns run android

WOW ...很棒:)

AND ..祝你好运♥— ZAKI

I have a Nativescript application that I'm developing using VS Code and have no issues when I try to run it using the Nativescript launch configurations from the Nativescript extension, when I'm using a real device connected with USB or when I use one of the android-sdk emulators.

Now I need to run Hyper-V on the machine too and those emulators cannot run when hypervisor is on. So I downloaded and installed Visual Studio Android Emulator which runs fine when I launch it manually.

Problem is that the nativescript project doesn't recognize this device either with tns device or adb devices commands and if I try to launch the application from VS Code it tries to launch one of the other emulators, which obviously fails due to the hypervisor/Intel Haax incompatibility.

Did any of you had this problem before and have any solutions you can share?

Thanks.

解决方案

Microsoft MSDN say :

If the emulator is running, but it does not appear to be connected to ADB or it does not appear in Android tools that make use of ADB (for example, Android Studio or Eclipse), you may need to adjust where the emulator looks for ADB.

The emulator uses a registry key to identify the base location of your Android SDK, and looks for the \platform-tools\adb.exe file under that directory.


Here We Go!! Step By Step ;)

Copy Your ANDROID SDK PATH for me it look like this :


To modify the Android SDK path used by the emulator:

  1. Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.


  1. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools in the folder tree on the left.

Note : if Android SDK Tools folder doesn't exist, Create it under WOW6432Node, And open it, And Create a String Value name it Path:)

  1. Modify the Path registry variable to match the path to your Android SDK.


  1. Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.


Now! Open Your Terminal (CMD), and Run ADB command

adb devices -l

YES YES !! The Visual Studio Emulator is running, and connected to ADB!


HERE WE GOO !!

Now We Want To Create A Demo App (for example FIRSTZAKI) ZAKI is my nickname :p

On Terminal (CMD) :

tns create FIRSTZAKI

Choose Android Platform

cd FIRSTZAKI\

tns platform add android

Check if VS EMULATOR is ready!

tns devices

YES YES ^^

Finally Step (RUN/BUILD) :

tns run android

WOW ... Great :)

AND .. Good Luck ♥ — ZAKI

这篇关于使用Visual Studio模拟器运行的Nativescript项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆