Brandon Stillitano
Brandon Stillitano

Reputation: 1637

Failed to resolve Gradle dependency

I am using a gradle dependency and have been for the past 12 months. All of a sudden today, it can not resolve.

I have tried changing the version, cleaning my build, reinstalling Android SDK's etc. but all to no avail.

I was hoping someone could help me in resolving this issue. The error is below:

Android Error Log Android Error Log 2

Gradle File Below:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

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

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "OMMITED-FOR-SECURITY"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 7
        versionName "1.0.3"
        testInstrumentationRunner "android.support.SplashActivity.runner.AndroidJUnitRunner"
        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true
        multiDexEnabled true

        ndk {
            abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a'
        }

        //Brandon's Added Config
        manifestPlaceholders = [onesignal_app_id: "583f96e8-3cec-416e-ad0e-7bdef470a6a7",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
    lintOptions {
        checkReleaseBuilds false
    }

    dexOptions {
        javaMaxHeapSize "2g"
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs '../aar'
        }
        maven {
            url 'https://maven.google.com'
        }
    }

    buildDir = 'Build'
}

dependencies {

    //File Tree
    compile fileTree(dir: 'libs', include: ['*.jar'])

    //Android Dependencies
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:multidex:1.0.1'

    //Parse Dependencies
    compile 'com.parse:parse-android:1.15.7'
    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.parse.bolts:bolts-applinks:1.4.0'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    compile 'com.parse:parseui-login-android:0.0.1'
    compile 'com.parse:parseui-widget-android:0.0.1'

    //Cloud Hosting Libraries
    compile 'com.dropbox.core:dropbox-core-sdk:3.0.2'
    compile('com.microsoft.aad:adal:1.2.2') {
        exclude group: 'com.android.support'
    }
    compile 'com.onedrive.sdk:onedrive-sdk-android:1.2.1'

    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
    compile 'com.ogaclejapan.arclayout:library:1.1.0@aar'

    compile 'com.squareup.okhttp3:okhttp:3.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.10.0'

    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.florent37:camerafragment:1.0.4'
    compile 'com.box:box-android-sdk:4.0.8'
    compile 'com.eclipsesource.minimal-json:minimal-json:0.9.1'
    compile 'com.kyleduo.switchbutton:library:1.4.5'
    compile 'net.danlew:android.joda:2.9.9'
    compile ('com.wdullaer:materialdatetimepicker:3.3.0') {
        exclude group: 'com.android.support'
    }
    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'org.apache.commons:commons-math3:3.6.1'
    compile 'com.github.axet:android-library:1.1.3'
    compile 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0'
    compile 'com.linsea:universalvideoview:1.1.0@aar'
    compile 'com.devbrackets.android:exomedia:4.0.3'
    compile 'com.flurgle:camerakit:0.9.18'
    testCompile 'junit:junit:4.12'
    compile 'homhomlin.lib:ptrrv-library:1.3.1'

    //Butter Knife
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
    compile 'com.github.oxoooo:touch-image-view:1.0.1'
    compile 'com.jakewharton:butterknife:8.5.1'

    //DMSDK Libraries
    compile(name: 'dms', ext: 'aar')
    compile(name: 'audiohelper', ext: 'aar')
    compile(name: 'camerahelper', ext: 'aar')

    //Brandon's Added libraries
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.github.michael-rapp:android-material-dialog:4.0.3'
    compile 'com.iceteck.silicompressorr:silicompressor:2.0'
    compile ('com.onesignal:OneSignal:[3.6.0, 3.99.99]') {
        exclude group: 'com.android.support'
        exclude group: 'com.google.android.gms'
    }
    compile 'com.orhanobut:dialogplus:1.11@aar'
    compile 'com.thefinestartist:finestwebview:1.2.7'
    compile 'info.hoang8f:android-segmented:1.0.6'
    compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'

    //IMG.LY Libraries
    compile 'ly.img.android:photo-editor-sdk:5.0.0-beta'

    //HTML Libraries
    compile 'jp.wasabeef:richeditor-android:1.2.2'
    compile 'org.sufficientlysecure:html-textview:3.4'

    //Play Service Libraries
    compile 'com.google.android.gms:play-services-gcm:11.2.2'
    compile 'com.google.android.gms:play-services-analytics:11.2.2'
    compile 'com.google.android.gms:play-services-drive:11.2.2'
    compile 'com.google.android.gms:play-services-gcm:11.2.2'
    compile 'com.google.android.gms:play-services-location:11.2.2'

    //Firebase Libraries
    compile 'com.google.firebase:firebase-appindexing:11.2.2'
    compile 'com.google.firebase:firebase-core:11.2.2'
    compile "com.google.firebase:firebase-database:11.2.2"
    compile 'com.google.firebase:firebase-auth:11.2.2'

    //Messaging Libraries
    compile 'com.github.stfalcon:chatkit:0.2.2'
    compile 'org.cryptonode.jncryptor:jncryptor:1.2.0'
}

apply plugin: 'com.google.gms.google-services'

My project wide build file is as follows:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'


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

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        maven { url "https://artifactory.9elements.com/artifactory/imgly" }
        maven { url "https://jitpack.io" }
    }
}

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

Upvotes: 4

Views: 5947

Answers (2)

Brandon Stillitano
Brandon Stillitano

Reputation: 1637

I have figured out the issue.

The issue was that the component author changed their IP address and failed to inform the community.

Gradle keeps a cache of plugins and I had to clear the cache in order to make gradle recognise the new IP address. To do this I did the following:

In Android Studio:

  1. File > Invalidate Caches / Restart...
  2. Invalidate and Restart

In Android Terminal (OSX):

./gradlew cleanBuildCache

In Android Terminal (Windows):

gradlew cleanBuildCache

Upvotes: 4

Nathan Strong
Nathan Strong

Reputation: 2400

This is going to sound weird, but you should check that your system clock is set correctly, including the proper time zone.

If your system time is correct, you might need to nuke and re-install your JVM.

Your build is failing because Gradle can't reach the artifact repository. When it tries to connect, it's throwing this error:

sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target

That's Gradle telling you that the TLS handshake between Gradle and the artifact repository is failing.

There's a few reasons this could happen:

  1. Somehow your trust store got zapped so the JVM doesn't recognized any SSL certs, including CA-signed ones.
  2. Your system time is so bonkered that the validation routine thinks the site's SSL certificate is expired, or hasn't taken effect yet.
  3. You're behind a TLS-aware proxy but you don't have the proxy's cert in your trust store.
  4. The repo's SSL certificates are in fact hosed (in which case it'd be down for everyone, not just you)

You can rule out most of these by pointing your web browser at the repository download URL shown in the error. If the file downloads, you know it's not your system time or the server's SSL certificates.

Upvotes: 0

Related Questions