✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.1.4 version and is up to date.
✔ Component @nativescript/core has 8.1.5 version and is up to date.
✖ Component @nativescript/android is not installed.
正如你在最后一行看到的,我的@nativescript/android 没有安装。 我安装了好几次。
还有当我
ns run android
我有这个
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.
@nativescript/android 需要位于 devDependency 中:
使用它从依赖项中删除:
npm r @nativescript/android
然后将其添加到 devDependencies 中:
npm i -D @nativescript/android
在 NativeScript 8.2.3 中,
ns doctor android
给出以下输出:所以我也安装了Android SDK 28(也安装了33仍然有这个问题)。此外,该消息还警告@nativescript/android 的更新可用。
将 @nativescript/android 从 8.1.1 更新到 8.2.2 解决了该问题:
npm i @nativescript/android@latest
。
退出终端并重新打开,它给了我相同的失败结果,但是一旦我退出并重新打开,然后运行
ns doctor android
,一切都已正确设置。