我该如何解决?无法解决:com.crashlytics.sdk.android:crashlytics:com.crashlytics.tools.gradle`

时间:2018-12-09 14:26:37

标签: android firebase gradle crashlytics

我正在我的应用程序上设置Firebase的crashlytics。

但是,构建gradle时发生以下错误。

我尝试过的事情:

  1. 为解决此问题,我尝试更改版本,但未解决。

  2. 然后我更改了存储库的顺序,但这也不是解决方案。

================================================ ============

下面是错误日志

Failed to resolve: com.crashlytics.sdk.android:crashlytics:com.crashlytics.tools.gradle

我的gradle文件在下面。

buildscript {
    ext.kotlin_version = '1.2.61'
    ext.zxing = '3.3.3'
    ext.zxing_embedded = '3.6.0'
    ext.support_library = '28.0.0'
    ext.google_services = '4.2.0'
    ext.firebase = '16.0.5'
    ext.fabric_tools_gradle = '1.27.0'
    ext.crashlytics = '2.9.6'

    repositories {
        maven {url 'https://maven.fabric.io/public'}
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.google.gms:google-services:$google_services"
        classpath "io.fabric.tools:gradle:$fabric_tools_gradle"
    }

}

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

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


apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "xxxxx.xxxxxxxxx" //blind
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 2
        versionName "1.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug {
            minifyEnabled true
            useProguard true
            shrinkResources false
            proguardFile getDefaultProguardFile('proguard-android.txt')
            proguardFile 'proguard-rules.pro'
            proguardFile 'proguard-zxing.pro'
            proguardFile 'progurad-support-design.pro'
        }

        release {
            minifyEnabled true
            useProguard true
            shrinkResources false
            proguardFile getDefaultProguardFile('proguard-android.txt')
            proguardFile 'proguard-rules.pro'
            proguardFile 'proguard-zxing.pro'
            proguardFile 'progurad-support-design.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    //test
//    testImplementation 'junit:junit:4.12'
//    androidTestImplementation 'com.android.support.test:runner:1.0.0'
//    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    //layout
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    //support library
    implementation "com.android.support:appcompat-v7:$support_library"   // Version 23+ is required
    implementation "com.android.support:design:$support_library"

    //zxing
    implementation("com.journeyapps:zxing-android-embedded:$zxing_embedded") { transitive = false }
    implementation "com.google.zxing:core:$zxing"

    //permission check util
    implementation 'rebus:permission-utils:2.0.7'

    // Add dependency
    implementation "com.crashlytics.sdk.android:crashlytics:$crashlytics"

    //firebase
    implementation "com.google.firebase:firebase-core:$firebase"
}

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

1 个答案:

答案 0 :(得分:1)

我不确定,但是尝试一下,告诉我是否工作

更改此

ext.crashlytics = '2.9.6'

对此

ext.crashlytics_version = '2.9.6'

并使用它

 implementation "com.crashlytics.sdk.android:crashlytics:$crashlytics_version"