3

I'm coming to you because I have build errors while compiling my android projects on Android Studio (even the more basic one): every time there's a dependency or something to download, I keep having the same problem:

Error:A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugUnitTestApkCopy'.

Could not resolve junit:junit:4.12. Required by: Android_VisiteARLabs:app:unspecified Could not resolve junit:junit:4.12. Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I don't know where it comes from, I work behind a proxy, but I configured it well: the test connection in android studio works fine and using a navigator, I can easily access the path of the wanted dependency ...

I've tried without the proxy, and it didn't work too.

I couldn't find out where does it come from.

EDIT:

Here is my app "build.gradle":

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.user.app"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    testCompile 'junit:junit:4.12'
}

And here is my project build.gradle file:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
RomainB
  • 71
  • 1
  • 5
  • 1
    post your build.gradle file – OBX Jan 23 '17 at 15:34
  • Possible duplicate of [Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target](http://stackoverflow.com/questions/6908948/java-sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find) – rafaelc Jan 23 '17 at 16:05

2 Answers2

4

Installing the network root ssl certificate to jre cacerts was not the solution, unless not the only one.

I've precised the URL of the jcenter bintray repository in my build.gradle file. Before it was like it :

jcenter()

and now it's like that :

jcenter{url "http://jcenter.bintray.com/"}

Thank you for your help,

RomainB
  • 71
  • 1
  • 5
2

You need to install your network root ssl certificate to jre cacerts! it is already answered lot of time refer this answer.

Community
  • 1
  • 1
positivecrux
  • 1,307
  • 2
  • 16
  • 35