尝试在Android Studio中添加Crashlytics(找不到方法...)

时间:2019-03-14 16:32:23

标签: android crashlytics google-fabric

我尝试将Crashlytics添加到我的项目中,但Gradle同步不顺利。

This is my build.gradle:
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.26.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.smartvibes.smartbeat"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}



dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.volley:volley:1.1.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.squareup.okio:okio:1.7.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.4.0'
    implementation 'org.osmdroid:osmdroid-android:6.0.3'
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'io.nlopez.smartlocation:rx:3.3.3'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation 'com.github.MikeOrtiz:TouchImageView:1.4.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9@aar' {
        transitive = true;
    }
}

这是我在清单中添加的内容:

<meta-data
            android:name="io.fabric.ApiKey"
            android:value="my key"
            />

我手动更改

compile ('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true;
    }

收件人

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9@aar' {
        transitive = true;
    }

因为不再支持编译。

尝试同步时的错误是: 错误:在类型为org.grads.api.internal.artifact的对象上找不到参数[build_ebny41u4h7onhh3ybv447hi4b $ _run_closure3 $ _closure8 @ 7d0b1f54]的方法com.crashlytics.sdk.android:crashlytics:2.9.9@aar()。 dependency.DefaultDependencyHandler。 打开文件

我在这个问题上用Google搜索,但是找不到合适的解决方案。 有人知道如何处理吗?

1 个答案:

答案 0 :(得分:2)

您快到了。只需用()来写:

implementation ('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true;
}