Nullpointerexception while ionic cordova run android



执行 ionic cordova 运行时获取空指针异常 运行 android:

E:WorkspaceAngularmyTabs>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:UsersghanendraAppDataLocalAndroidsdk
JAVA_HOME=C:Program FilesJavajdk1.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:WorkspaceAngularmyTabsplatformsandroidbuild.gradle:137)
Checking the license for package Android SDK Build-Tools 26 in C:UsersghanendraAppDataLocalAndroidsdklicenses
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 添加到以下路径gradle wrapper

C:UsersgAppDataLocalAndroidsdktoolsgradle

还尝试了此链接中给出的说明

在安卓工作室中使用 sdk 管理器更新了所有 sdk 工具。

我已经安装了 android 工作室(也能够使用它构建 andriod 本机应用程序(和 sdk 工具和ANDRIOD_HOME在系统环境变量中配置的路径。

尝试:

$ cordova rm platform android && cordova add platform android

最新更新