nativescript - 带有 vue 和 ts 的 Nativescript 无法构建
问题描述
我创建了一个 nativescript vue 模板:
sudo vue init nativescript-vue/vue-cli-template project
当我尝试使用 command: 运行它时,tns run
出现以下错误:
Gradle build...
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/home/petar/Documents/Workspace/js/project/platforms/android/app/build.gradle' line: 221
* What went wrong:
A problem occurred evaluating project ':app'.
> Invalid revision: undefined
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/petar/Documents/Workspace/js/roomy/roomy/platforms/android/local.properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Unable to apply changes on device: 2383f95c9f0d7ece. Error is: Command ./gradlew failed with exit code 1.
此外,我在运行命令后收到了几个警告。我安装了 Android Studio,尝试正确设置 JAVA_HOME 变量以及其他一些东西,但没有任何效果。
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory.
✖ 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
✖ WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
解决方案
您已经安装了 Android Studio,但可能没有设置 ANDROID_SDK_ROOT 环境变量,如错误 2 和 tns 所指。您使用的是什么操作系统?
推荐阅读
- php - 在自定义商店页面 WooCommerce 上显示子子类别
- mysql - 如何从帐户表中检查和提取多封电子邮件的数据?
- angular - 你知道为什么当我添加一个项目时它控制台记录两次吗?
- python - 将列表转换为字符串的 Python 程序
- typescript - 如何将返回类型添加到范围函数?
- python - 将 PyCaret 与神经网络一起用于回归问题的问题
- html - CSS - 可编辑表中一行中不同td高度的问题
- python - 文件未在 IDLE 中导入 (Anaconda/Mac/IDLE)
- pytorch - Huggingface PYtorch 变压器管道分段故障 Raspberry PI
- toad - 在 Toad 中复制当前行的按键