无法解析Gradle依赖项

4

我使用了gradle依赖项已经有12个月了,但是突然今天它无法解析。

我尝试更改版本、清理构建、重新安装Android SDK等,但都没有效果。

我希望有人能帮助我解决这个问题。错误信息如下:

Android Error Log Android Error Log 2

Gradle文件如下:

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'

我的项目宽度构建文件如下所示:
// 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
}

如果有任何意义的话,这种情况只发生在安装OSX High Sierra之后。 - Brandon Stillitano
2个回答

4
我已经找出了问题所在。
问题是组件作者更改了他们的IP地址并未通知社区。
Gradle保留了插件缓存,我必须清除缓存以使gradle识别新的IP地址。为此,我执行了以下操作: 在Android Studio中:
  1. 文件 > 无效缓存/重启...
  2. 无效并重启
在Android终端(OSX)中: ./gradlew cleanBuildCache 在Android终端(Windows)中: gradlew cleanBuildCache

0
这可能听起来很奇怪,但您应该检查您的系统时钟是否正确设置,包括正确的时区。
如果您的系统时间是正确的,您可能需要彻底卸载并重新安装JVM。
您的构建失败是因为Gradle无法访问工件库。当它尝试连接时,会抛出此错误:
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target

这是Gradle告诉你Gradle和构件库之间的TLS握手失败了。

有几个原因可能会导致这种情况:

  1. 一些方式破坏了您的信任存储,因此JVM无法识别任何SSL证书,包括CA签名的证书。
  2. 您的系统时间非常不准确,验证程序认为站点的SSL证书已过期或尚未生效。
  3. 您在TLS感知代理后面,但您没有将代理的证书放入信任存储中。
  4. 仓库的SSL证书实际上已经损坏(在这种情况下,不仅您,而且其他人也无法使用)

您可以通过将Web浏览器指向错误中显示的存储库下载URL来排除大多数问题。如果文件下载成功,则知道不是您的系统时间或服务器的SSL证书的问题。


感谢您的建议。在将我的浏览器指向https://artifactory.9elements.com/artifactory/imgly/ly/img/android/photo-editor-sdk/5.0.0-beta/photo-editor-sdk-5.0.0-beta.pom之后,它顺利地下载了。现在我在想,我是否应该删除Java并重新安装它?如果是这样,我该如何操作? - Brandon Stillitano
很好。这表明JDK层面存在问题。我不认为您对系统启动脚本进行了任何黑客攻击,以设置全局的JAVA_HOME。因为如果您这样做了,在升级过程中,这些黑客攻击可能已经被还原。如果以上方法都失败了,也许可以完全删除Java并重新安装最新的JDK。如果是受损的信任存储,则应该可以解决问题。 - Nathan Strong
据我所知,我从未修改过JDK或Java安装,所以在这方面是安全的。我已经卸载了JDK和Java,并重新安装了JDK8u144,在重启Mac后仍然出现相同的错误。 - Brandon Stillitano
我注意到他们的artifactory SSL证书是由Let's Encrypt颁发的。我觉得他们的交叉签名证书与JDK的默认信任存储不兼容。从https://letsencrypt.org/certificates/下载根证书,并使用keytool将其导入`$JAVA_HOME/jre/lib/security/cacerts`,我认为这样做可以解决你的问题。 - Nathan Strong

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接