0

I am getting this error when trying to build a project created using Cordova CLI. I have added the android platform to the project.

D:\MHIS_Phonegap\MHIS>cordova build --info android
Running command: cmd "/s /c "D:\MHIS_Phonegap\MHIS\platforms\android\cordova\build.bat""
ANDROID_HOME=E:\adt-bundle-windows-x86_64-20130522\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
Running: D:\MHIS_Phonegap\MHIS\platforms\android\gradlew cdvBuildDebug -b D:\MHIS_Phonegap\MHIS\platforms\android\build.gradle -Dorg.gradle.daemon=true

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 resolve com.android.tools.build:gradle:1.0.0+.
 Required by:
     :android:unspecified
  > Failed to list versions for com.android.tools.build:gradle.
     > Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
        > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
           > peer not authenticated

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

BUILD FAILED

Total time: 11.562 secs

D:\MHIS_Phonegap\MHIS\platforms\android\cordova\node_modules\q\q.js:126
                throw e;
                      ^
Error code 1 for command: cmd with args: /s /c "D:\MHIS_Phonegap\MHIS\platforms\android\gradlew cdvBuildDebug -b D:\MHIS_Phonegap\MHIS\platforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\lenovo\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

Any help on what is the cause and how to resolve?

S_S
  • 1,276
  • 4
  • 24
  • 47
  • seems you have issue with graddle. Maybe try to uninstall cordova and the cordova android platform and re-install everything. Graddle build is new to cordova 4 or 5. I 've seen a SO question where someone answered with a way to build with ant instead of graddle, maybe it could help you? – QuickFix Jul 03 '15 at 12:58
  • check this out , may be helpful. http://stackoverflow.com/questions/29992597/phonegap-build-fails-with-exit-code-2 – shamaleyte Jul 03 '15 at 15:57
  • None of these are helping, any other options? I had to do this hack to install cordova via [npm](http://blog.npmjs.org/post/78165272245/more-help-with-self-signed-cert-in-chain-and-npm) – S_S Jul 07 '15 at 11:54

0 Answers0