具有vue和ts的本机脚本无法构建

时间:2019-12-21 23:51:21

标签: nativescript

我创建了一个本地脚本vue模板:

 sudo vue init nativescript-vue/vue-cli-template project

当我尝试使用命令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 

1 个答案:

答案 0 :(得分:0)

您已经安装了Android Studio,但由于错误2和tns所指出的,可能尚未设置Android环境变量ANDROID_SDK_ROOT。 您正在使用什么操作系统?