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

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

问题描述

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

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

问题是 nativescript 项目无法使用 tns device 或 adb devices 命令识别此设备,如果我尝试从 VS Code 启动应用程序,它会尝试启动其他模拟器之一,这显然是由于管理程序/Intel Haax 不兼容.

你们之前有没有遇到过这个问题并且有任何可以分享的解决方案?

谢谢.

解决方案

Microsoft MSDN 说:

如果模拟器正在运行,但它似乎没有连接到 ADB 或者它没有出现在使用 ADB 的 Android 工具中(例如,Android Studio 或 Eclipse),您可能需要调整模拟器查找 ADB 的位置.

模拟器使用注册表项来识别Android SDK的基本位置,并寻找platform-toolsadb.exe 该目录下的文件.

<小时>

我们开始!!一步一步;)

复制你的 ANDROID SDK PATH 给我,它看起来像这样:

<小时>

修改模拟器使用的Android SDK路径:

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

<小时>

  1. 导航到左侧文件夹树中的 HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeAndroid SDK Tools.

<块引用>

注意:如果Android SDK Tools文件夹不存在,在WOW6432Node下创建,打开,创建String Value将其命名为 Path:)

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

<小时>

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

<小时>

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

adb devices -l

是的,是的!Visual Studio Emulator 正在运行,并已连接到 ADB!

<小时>

我们来了!!

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

在终端 (CMD) 上:

tns 创建 FIRSTZAKI

选择安卓平台

cd FIRSTZAKI

tns平台添加android

检查 VS EMULATOR 是否准备就绪!

tns 设备

是是的^^

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

tns 运行安卓

哇...太棒了:)

还有 .. 祝你好运♥ — 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-toolsadb.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_MACHINESOFTWAREWOW6432NodeAndroid 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 Emulator 运行的 Nativescript 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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