Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
259 views
in Technique[技术] by (71.8m points)

android - getting gradle error while creating cordova project

I just updated cordova version from 4.0 to 5.1, and everything worked fine also in creating project. But as soon as I gave command of cordova build I got below error.

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

After 2 days suffering I came to know it's coming due to gradle, I downloaded and added it also in environment variable. I do get this error also when I go to android folder in cordova project and give command of gradle init. Don't know what can be reason of it. Am still using eclipse instead of android studio can it also be a reason ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a Java SSL connection error, you need to add the appropriated SSL certificate to the Java Keystore for Java accept the connection.

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

sudo keytool -import -alias MavenRepo -keystore $JAVA_HOME/jre/lib/security/cacerts -file /PATH/TO/YOUR/EXPORTED/FILE.crt

Your $JAVA_HOME variable should be declared in your .bashrc file, 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: https://github.com/meteor/meteor/issues/6362#issuecomment-189852511


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...