Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio-Build Failed

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
}
like image 960
RomainB Avatar asked Mar 15 '26 07:03

RomainB


1 Answers

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,

like image 147
RomainB Avatar answered Mar 17 '26 21:03

RomainB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!