1
votes

The project gets build successfully if we select Ripple - IOS, however for Android - Device the build shows following errors:

MSBUILD : cordova-build error : FAILURE: Build failed with an exception. FAILURE: Build failed with an exception.

MSBUILD : cordova-build error : * What went wrong: * What went wrong: MSBUILD : cordova-build error : A problem occurred configuring root project 'android'. A problem occurred configuring root project 'android'. MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':classpath'.

Could not resolve all dependencies for configuration ':classpath'. MSBUILD : cordova-build error : > Could not resolve com.android.tools.build:gradle:1.5.0. Could not resolve com.android.tools.build:gradle:1.5.0. MSBUILD : cordova-build error : Required by: Required by: MSBUILD : cordova-build error : :android:unspecified :android:unspecified MSBUILD : cordova-build error : > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'. Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'. MSBUILD : cordova-build error : > Connection to https://repo1.maven.org refused Connection to https://repo1.maven.org refused

BUILD FAILED

Total time: 44.203 secs MSBUILD : cordova-build error : * Try: * Try: MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"C:\Users\\platforms\android\gradlew cdvBuildDebug -b C:\Users\\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" You may not have the required environment or OS to build this project MSBUILD : cordova-build error : Error code 1 for command: cmd with args: /s,/c,"C:\Users\\platforms\android\gradlew cdvBuildDebug -b C:\Users\\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" Error code 1 for command: cmd with args: /s,/c,"C:\Users\\android\gradlew cdvBuildDebug -b C:\Users\\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

1
Will you run into see issue when building a blank new Cordova project?Alan Yao - MSFT

1 Answers

3
votes

You might be seeing this error if your developer PC is behind a network proxy. If that's the case, then make sure you're first working with at least Update 8 of the Visual Studio Tools for Apache Cordova, which improve support for network proxies.

Also, from another post I found, you may try customizing your proxy settings for Gradle. The answer from the referenced post mentions creating a gradle.properties file, using the following code as a guide for your specific proxy settings:

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

(Learn more about these settings in the official Gradle docs)

Since you're using Visual Studio, your best practice here is to actually place the gradle.properties file in the res\native\android folder of your project. Upon build, that file will then be copied into the platforms\android folder used by Cordova.