2017-06-18 261 views
1

獲得的NullPointerException:的NullPointerException而離子科爾多瓦執行離子科爾多瓦運行機器人時運行Android

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

使用sdk manager i更新了所有的sdk工具在Android工作室之前。

我已經安裝了android studio(也能夠使用它創建andriod原生應用程序)以及sdk工具的路徑和系統環境變量中配置的ANDRIOD_HOME。

回答

0

Try:

$ cordova rm platform android && cordova add platform android