android – 创建cordova项目时出现gradle错误

我刚刚将cordova版本从4.0更新到5.1,并且在创建项目时一切正常.但是一旦我指挥了cordova构建,我就得到了以下错误.

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'.
               > peer not authenticated

经过2天的痛苦,我开始知道它是由于gradle而来,我下载并将其添加到环境变量中.当我在cordova项目中访问android文件夹并给出gradle init命令时,我也会收到此错误.不知道是什么原因造成的.我仍然使用eclipse而不是android studio这也是一个原因吗?

这是一个Java SSL连接错误,您需要将适当的SSL证书添加到Java Keystore for Java接受连接.

Step 1: Download the certificate

With Mozilla Firefox:

  1. Go to https:// repo1.maven.org (remove the space).
  2. Click on the green padlock at the left of the address bar.
  3. Click on Details.
  4. Click on View certificate.
  5. Click on Details.
  6. Click on Export.
  7. Export file to “X.509 Certificate (PEM) (*.crt; *.pem)”

Step 2: Add the certificate to default Java Keystore

06000

Your $JAVA_HOME variable should be declared in your 07000, so you can use this command just replacing the /PATH/TO/YOUR/EXPORTED/FILE parameter.

PS: The default password of Java Keystore is: changeit

From: 07001

https://stackoverflow.com/questions/30995348/getting-gradle-error-while-creating-cordova-project

转载注明原文:android – 创建cordova项目时出现gradle错误