【发布时间】:2019-03-11 21:00:13
【问题描述】:
我坚持使用这个 https://docs.nativescript.org/start/cli-basics NativeScript HelloWorld 示例。 当我运行“tns doctor”时,一切似乎都很好,当我运行“tns device”时,我可以看到我的 avd 处于连接状态。 但是当我尝试使用“tns run android”运行我的项目时,我得到了一个 gradle 错误。我以前从未使用过 gradle,而且我对移动开发真的很陌生,所以我不知道,我能做些什么来解决这个问题。消息:
$ tns run android
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Skipping prepare.
Building project...
Gradle build...
FAILURE: Build failed with an exception.
在哪里: 构建文件'/home/lars/Projects/app/Test/platforms/android/app/build.gradle'行:24
-
出了什么问题: 评估项目 ':app' 时出现问题。
无法初始化类 com.android.build.gradle.internal.crash.PluginCrashReporter
尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
在 1 秒内构建失败 无法在设备上应用更改:emulator-5554。错误是:命令 ./gradlew 失败,退出代码为 1。 停止 webpack 监视
我正在使用 Ubuntu 18.04 (Kubuntu)、java 版本“1.8.0_201”和tns info 提供以下信息:
✔ Getting NativeScript components versions information...
✔ Component nativescript has 5.2.2 version and is up to date.
✔ Component tns-core-modules has 5.2.2 version and is up to date.
✔ Component tns-android has 5.2.1 version and is up to date.
✔ Component tns-ios has 5.2.0 version and is up to date.
我已经尝试解决这个问题好几天了,但不知道我能做什么。
【问题讨论】:
-
sudo apt-get install openjdk-8-jdk ?你能确认你的 JAVA_HOME 吗?设置正确吗?
-
也尝试重新安装Android工具并再次设置路径 export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"
-
确保您已正确完成 Nativescript 安装,检查您的环境。变量(它们是否指向正确的 Android/Java 目录),运行 tns doctor 并确保没有冲突,然后重试
标签: java android gradle sdk nativescript