2
votes

ionic platform add android got the following error. How to fix it? Should the file be downloaded from another source?

BUILD FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not download gradle.jar (com.android.tools.build:gradle:2.2.0)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar'.
         > Failed to move file 'C:\Users\....\AppData\Local\Temp\gradle_download5163584130402676113bin' into filestore a
t 'C:\Users\....\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle\2.2.0\e15d0f8c5ca4d152ec0ef5654b47d31
c899ea22e\gradle-2.2.0.jar'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


Total time: 1 mins 31.633 secs

Failed to install 'cordova-plugin-console':Error: cmd: Command failed with exit code 1
    at ChildProcess.whenDone (D:\Users\....\myApp\platforms\android\cordova\node_modules\cordova-commo
n\src\superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: cmd: Command failed with exit code 1
2

2 Answers

0
votes

gradle.jar error is mostly occurs because of unsuccessful installtion of cordova, or it is break some where while installing it

So try uninstall cordova by the below command and again intall it

npm uninstall -g cordova

Make sure there are lots of problem with Cordova version 6.4.0 so install specific version

npm install -g [email protected] // 6.2.0 is still working fine

Then install ionic again

npm install -g ionic

See my answer here for Cordova version problems.

Also let me know if this is(gradle error solution) working for you or not.

0
votes

This was an answer posted by me. Follow these guidelines to make it work. https://stackoverflow.com/a/41345071/6554634 Do not miss a single step. Do not forget to give correct paths for all environment variables. Make sure that your SDK platform tools build tools are up to date. If no, update SDK.