【发布时间】:2017-06-18 08:12:57
【问题描述】:
执行ionic cordova run android时出现nullpointerexception:
E:\Workspace\Angular\myTabs>ionic cordova run android --device
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve
--externalIpRequired --nobrowser
[13:31:48] build dev started ...
[13:31:49] clean started ...
[13:31:49] clean finished in 18 ms
[13:31:49] copy started ...
[13:31:49] transpile started ...
[13:32:04] transpile finished in 14.96 s
[13:32:04] preprocess started ...
[13:32:04] deeplinks started ...
[13:32:04] deeplinks finished in 61 ms
[13:32:04] preprocess finished in 66 ms
[13:32:04] webpack started ...
[13:32:05] copy finished in 16.44 s
[13:32:45] webpack finished in 41.65 s
[13:32:45] sass started ...
[13:32:50] sass finished in 4.80 s
[13:32:50] postprocess started ...
[13:32:50] postprocess finished in 17 ms
[13:32:50] lint started ...
[13:32:50] build dev finished in 61.72 s
> cordova run android --device
ANDROID_HOME=C:\Users\ghanendra\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_51
Subproject Path: CordovaLib
[13:33:03] lint finished in 12.38 s
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.
doLast(Action) instead.
at build_1n7tz8l3280mv8kwgyclznwu1.run(E:\Workspace\Angular\myTabs\platforms\android\build.gradle:137)
Checking the license for package Android SDK Build-Tools 26 in C:\Users\ghanendra\AppData\Local\Android\sdk\licenses
License for package Android SDK Build-Tools 26 accepted.
Preparing "Install Android SDK Build-Tools 26".
BUILD FAILED
Total time: 8.785 secs
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android --device (exit code 1).
我一直在寻找解决方案,尝试通过运行gradle wrapper 命令手动将 gradle 添加到以下路径:
C:\Users\g\AppData\Local\Android\sdk\tools\gradle
还尝试了link中给出的说明
使用 android studio 中的 sdk manager 更新了所有 sdk 工具。
我已经安装了android studio(也可以使用它构建andriod本机应用程序)并在系统环境变量中配置了sdk工具和ANDRIOD_HOME的路径。
【问题讨论】:
标签: android cordova ionic-framework ionic2