无法获取资源'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'

时间:2018-11-05 18:46:40

标签: javascript android .net cordova gradle

我已经安装了Visual Studio 2017的Cordova Tools。可以在浏览器仿真中运行它,但是效果很好,但是当我尝试构建APK时,它失败并显示以下错误消息:

 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

1 个答案:

答案 0 :(得分:0)

解决方案是升级到Java 1.8 通过下载JDK,然后将Java主目录指向java 1.8目录 由于TLS1.2应该可以正常工作,并且由于安全性而不再使用TLS1.0和TLS 1.1。 Java 1.8支持TLS1.2 https://stackoverflow.com/a/50824799/10825931

  1. 从Oracle网站下载并安装Java 1.8 JDK
  2. 去视觉工作室
  3. 转到工具>选项
  4. 转到用于Apache Cordova的工具,然后覆盖环境变量
  5. 转到通常在Program Files / Java中设置JDK 1.8的目录,或者 程序文件(x86)/ Java,取决于32位或64位版本 安装并单击确定
  6. 开始构建Apk