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

    相關問題