0

I got error when I try to run "D:\MyApp\app>ionic build android" command.Upto that all processes are work properly .Can any one tell me proper solution for that.Thanks in advance.

D:\MyApp\app>ionic build android
Running command: "C:\Program Files (x86)\nodejs\node.exe" D:\MyApp\app\hooks\aft
er_prepare\010_add_platform_class.js D:\MyApp\app
add to body class: platform-android
Running command: cmd "/s /c "D:\MyApp\app\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\rajitha\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
Running: D:\MyApp\app\platforms\android\gradlew cdvBuildDebug -b D:\MyApp\app\pl
atforms\android\build.gradle -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

I can not understand what are they telling to me.Because I set all environment variables ex-JAVA,ANDROID

* 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/co
m/android/tools/build/gradle/maven-metadata.xml.
            > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/maven-metadata.xml'.
               > Connection to https://repo1.maven.org refused

* 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: 6.474 secs

D:\MyApp\app\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "D:\MyApp\app\platforms\android\g
radlew cdvBuildDebug -b D:\MyApp\app\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\rajitha\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)
Rajitha Perera
  • 1,581
  • 5
  • 26
  • 42
  • Take a look at 1º answer http://stackoverflow.com/questions/30219065/gradle-cant-connect-to-maven-repo-through-corporate-proxy-need-to-configure-t worked for me –  Jul 30 '15 at 17:12

1 Answers1

2

I got the same error. I just turned off the firewall and it built with no errors. So you must check if the connection is right. Make sure you can ping https://repo1.maven.org (I was able, but cordova was blinded by the firewall) to ensure the target is accessible

carcanholo
  • 161
  • 1
  • 8