0

My company admin helped me to install the Android Studio, but when I try to create a project, it come with error

Error:A problem occurred configuring project ':app'.
> Could not download junit.jar (junit:junit:4.12)
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'.
> Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

After investigate the log file, I found that Gradle cannot download the JUnit library, which possibly caused by firewall.

org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'

However, if I use browser go to this URL, I'm able to grab this jar (with warning, but can bypass it).

So my question is, can I pass this jar to Gradle or append to classpath for Gradle?
And one more thing, I don't have admin right and can't modify the Program Files

Thanks in advance!

UPDATE
At the end, I have solved this problem by following steps:

  1. Fix the SSL problem, as my company's firewall will alter the certificate, I need to add that into java keystore (Details in Here)

  2. After fixed the SSL problem, it throw another exception Failed to resolve: junit:junit:4.12 and more other library, I follow another post "Error:(23, 17) Failed to resolve: junit:junit:4.12" to solve this.

Hope this can help if anyone have the same problem.

Happy coding~~~

Community
  • 1
  • 1
Prisoner
  • 1,839
  • 2
  • 22
  • 38

1 Answers1

0

A very simple way is you can put the junit jar file in the android project "libs" folder

Gradle will add this to the classpath, if you open the build.gradle file, you will get something like

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    ......
}
Liping Huang
  • 4,378
  • 4
  • 29
  • 46