【发布时间】:2019-07-21 15:36:36
【问题描述】:
我正在尝试在我的计算机上安装 Nativescript CLI,并且我已经完成了网站上列出的所有步骤。当我运行tns doctor 时,我得到以下输出:
C:\WINDOWS\system32>tns doctor
√ Getting environment information
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
There seem to be issues with your configuration.
√ Getting NativeScript components versions information...
√ Component nativescript has 6.0.1 version and is up to date.
√ Your ANDROID_HOME environment variable is set and points to correct directory.
√ The Android SDK is installed.
√ Javac is installed and is configured properly.
√ The Java Development Kit (JDK) is installed and is configured properly.
√ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
× WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
× Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later.
Run `$ sdkmanager` to manage your Android SDK versions.
× You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=28'.
Run `$ sdkmanager` from your command-line to install required `Android Build Tools`. In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly.
我运行了echo %JAVA_HOME% 和echo %ANDROID_HOME% 并收到以下结果:C:\Program Files\Java\jdk-12.0.1 和C:\Android\android-sdk。
当我运行sdkmanager 时,我得到以下信息:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
我检查了我的 JAVA_HOME 和 ANDROID_HOME 环境变量,它们是正确的并且与 cmd 输出匹配。
我也尝试过卸载并重新安装 Nativescript CLI。我得到了完全相同的结果。
安装 Android Studio 可能会导致此问题吗?
【问题讨论】:
标签: android nativescript