NativeScript Android 构建错误 - “版本无效:空”

问题描述

我有一个 NativeScript 项目 (repo here),当我使用以下命令在 ios 模拟器上运行它时运行良好:

tns run ios

我现在正尝试在带有 tns run android 的 android 模拟器上运行它,但我不断收到错误消息“无效版本:null”,没有其他消息或解释...

我使用的是 mac 10.15.6 并安装了此版本的 Android Studio 和 sdk:

Android Studio 4.1.1
Build #AI-201.8743.12.41.6953283,built on November 4,2020
Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.6
GC: ParNew,ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true,external.system.auto.import.disabled=true

这是我的 tns info 输出:

✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 7.0.8 and the latest available version is 7.0.12.
✔ Component tns-core-modules has 6.5.24 version and is up to date.
✔ Component tns-ios has * version and is up to date.
✔ Component tns-android has * version and is up to date.

我使用这些命令创建了一个新的 android 模拟器设备:

cd $ANDROID_HOME/tools/bin
avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"

并接受许可。当我运行 avdmanager list 时,我可以看到大量的 android 设备模拟器:

bin ★ avdmanager list
Available Android Virtual Devices:
    Name: test
    Path: /Users/jlynch/.android/avd/test.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Parsing /usr/local/Caskroom/android-sdk/4333796/patcher/v4/package.xmlParsing /usr/local/Caskroom/android-sdk/4333796/system-images/android-25/google_apis/x86/package.xmlParsing /usr/local/Caskroom/android-sdk/4333796/tools/package.xmlAvailable devices definitions:
id: 0 or "tv_1080p"
    Name: Android TV (1080p)
    OEM : Google
    Tag : android-tv
---------
id: 1 or "tv_720p"
    Name: Android TV (720p)
    OEM : Google
    Tag : android-tv
---------
id: 2 or "wear_round"
    Name: Android Wear Round
    OEM : Google
    Tag : android-wear
---------
id: 3 or "wear_round_chin_320_290"
    Name: Android Wear Round Chin
    OEM : Google
    Tag : android-wear
---------
id: 4 or "wear_square"
    Name: Android Wear Square
    OEM : Google
    Tag : android-wear
---------
id: 5 or "Galaxy Nexus"
    Name: Galaxy Nexus
    OEM : Google
---------
id: 6 or "Nexus 10"
    Name: Nexus 10
    OEM : Google
---------
id: 7 or "Nexus 4"
    Name: Nexus 4
    OEM : Google
---------
id: 8 or "Nexus 5"
    Name: Nexus 5
    OEM : Google
---------
id: 9 or "Nexus 5X"
    Name: Nexus 5X
    OEM : Google
---------
id: 10 or "Nexus 6"
    Name: Nexus 6
    OEM : Google
---------
id: 11 or "Nexus 6P"
    Name: Nexus 6P
    OEM : Google
---------
id: 12 or "Nexus 7 2013"
    Name: Nexus 7
    OEM : Google
---------
id: 13 or "Nexus 7"
    Name: Nexus 7 (2012)
    OEM : Google
---------
id: 14 or "Nexus 9"
    Name: Nexus 9
    OEM : Google
---------
id: 15 or "Nexus One"
    Name: Nexus One
    OEM : Google
---------
id: 16 or "Nexus S"
    Name: Nexus S
    OEM : Google
---------
id: 17 or "pixel"
    Name: Pixel
    OEM : Google
---------
id: 18 or "pixel_c"
    Name: Pixel C
    OEM : Google
---------
id: 19 or "pixel_xl"
    Name: Pixel XL
    OEM : Google
---------
id: 20 or "2.7in QVGA"
    Name: 2.7" QVGA
    OEM : Generic
---------
id: 21 or "2.7in QVGA slider"
    Name: 2.7" QVGA slider
    OEM : Generic
---------
id: 22 or "3.2in HVGA slider (ADP1)"
    Name: 3.2" HVGA slider (ADP1)
    OEM : Generic
---------
id: 23 or "3.2in QVGA (ADP2)"
    Name: 3.2" QVGA (ADP2)
    OEM : Generic
---------
id: 24 or "3.3in WQVGA"
    Name: 3.3" WQVGA
    OEM : Generic
---------
id: 25 or "3.4in WQVGA"
    Name: 3.4" WQVGA
    OEM : Generic
---------
id: 26 or "3.7 FWVGA slider"
    Name: 3.7" FWVGA slider
    OEM : Generic
---------
id: 27 or "3.7in WVGA (Nexus One)"
    Name: 3.7" WVGA (Nexus One)
    OEM : Generic
---------
id: 28 or "4in WVGA (Nexus S)"
    Name: 4" WVGA (Nexus S)
    OEM : Generic
---------
id: 29 or "4.65in 720p (Galaxy Nexus)"
    Name: 4.65" 720p (Galaxy Nexus)
    OEM : Generic
---------
id: 30 or "4.7in WXGA"
    Name: 4.7" WXGA
    OEM : Generic
---------
id: 31 or "5.1in WVGA"
    Name: 5.1" WVGA
    OEM : Generic
---------
id: 32 or "5.4in FWVGA"
    Name: 5.4" FWVGA
    OEM : Generic
---------
id: 33 or "7in WSVGA (Tablet)"
    Name: 7" WSVGA (Tablet)
    OEM : Generic
---------
id: 34 or "10.1in WXGA (Tablet)"
    Name: 10.1" WXGA (Tablet)
    OEM : Generic
Available Android targets:

但是,当我运行 tns device 时,它只显示一个 ios 设备。 ?

当我尝试运行 tns run androidtns platform add android 时出现此错误:

Invalid Version: null

enter image description here

感谢有关如何通过此测试并为 ios 和 android 模拟器构建应用程序的任何建议。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...