1
votes

Since Monday I am facing an issue related to sun.security.ValidatorException. Before last Monday every thing was working fine.

Exception is :
A problem occurred configuring root project 'CoreApp'.

Could not resolve all files for configuration ':classpath'. Could not download gradle.jar (com.android.tools.build:gradle:3.1.2) Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar'. Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar'. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Could not download sdk-common.jar (com.android.tools:sdk-common:26.1.2) Could not get resource 'https://jcenter.bintray.com/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.jar'. Could not HEAD 'https://jcenter.bintray.com/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.jar'. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Could not download sdklib.jar (com.android.tools:sdklib:26.1.2) Could not get resource 'https://jcenter.bintray.com/com/android/tools/sdklib/26.1.2/sdklib-26.1.2.jar'. Could not HEAD 'https://jcenter.bintray.com/com/android/tools/sdklib/26.1.2/sdklib-26.1.2.jar'. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Cause: unable to find valid certification path to requested target

My app level gradle is :

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {

        applicationId "com.package.app"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 2000044
        versionName "4.1.1"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "3g"
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.google.firebase:firebase-core:15.0.2'
    compile 'com.google.firebase:firebase-config:15.0.2'
    compile 'com.google.firebase:firebase-messaging:15.0.2'
    compile 'com.google.android.gms:play-services-tagmanager:15.0.2'
    compile 'com.google.android.gms:play-services-auth:15.0.0'
    compile 'com.google.android.gms:play-services-maps:15.0.0'
    compile 'com.google.android.gms:play-services-location:15.0.0'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    //compile 'com.google.firebase:firebase-crash:12.0.1'
    compile 'com.crashlytics.sdk.android:crashlytics:2.9.2'
    compile 'com.facebook.android:facebook-android-sdk:4.31.0'
    compile 'com.appsflyer:af-android-sdk:4.8.9@aar'
    compile 'com.android.installreferrer:installreferrer:1.0'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'

And project level gradle is :

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'io.fabric.tools:gradle:1.25.1'

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I don't know what is the problem. Please help I am not able to development due to this error.

2
can you check firewall on your internet connection. it restricts some dependencies to download.Ankit Mehta
Yes I have checked Firewall If I oprn link 'jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/…' in browser than We are able to download jar file without any restrictionSanjay Kumar

2 Answers

0
votes

I faced similar problem a while ago, I did the following

  1. Make sure you have disabled offline work form Project Settings

  2. If you are working on windows just clear the gradle caches (see this) and then sync the project. It should work.

0
votes

I see this sometimes when I forget to run IntelliJ in admin mode. Running in admin mode has solved this issue for me several times. Not sure why, but hopefully this helps someone else.