0

I have installed Cordova Tools for Visual Studio 2017. Running it in browser emulation works fine, but when I try to build an APK, it fails with the following error message:

 Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
  Warning: 'keystore' and 'alias' need to be specified to generate a signed archive.
  Validation (CSS 4.0): "cover" is not a valid value for the "background" property.
  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.
  Picked up _JAVA_OPTIONS: -Xmx512M
  FAILURE: Build failed with an exception.
  FAILURE: Build failed with an exception.
  Error: cmd: Command failed with exit code 1 Error output:
  A problem occurred configuring root project 'android'.
  A problem occurred configuring root project 'android'.
  > Could not resolve all dependencies for configuration ':classpath'.
  > Could not resolve all dependencies for configuration ':classpath'.
  * What went wrong:
  * What went wrong:
  * Try:
  * Try:
   Required by:
   Required by:
   > Received fatal alert: protocol_version
   > Received fatal alert: protocol_version
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
   > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
   > Connection reset
   > Connection reset
   :android:unspecified
   :

android:unspecified

Mike Burton
  • 3,010
  • 24
  • 33

1 Answers1

0

Solution is to upgrade to Java 1.8 By downloading the JDK then point the Java home to the java 1.8 directory That should work due to TLS1.2 and discontinued TLS1.0 and TLS 1.1 due to security. Java 1.8 support TLS1.2 https://stackoverflow.com/a/50824799/10825931

  1. Download and install Java 1.8 JDK from Oracle website
  2. Go to visual studio
  3. Go to Tools > Options
  4. Go to Tools for Apache Cordova then Environment Variable Overrides
  5. Go and set the directory of JDK 1.8 usually in Program Files/Java or Program Files(x86)/Java depending on whether 32bit or 64bit version installed and click OK
  6. Go and build the Apk
veben
  • 19,637
  • 14
  • 60
  • 80