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

问题描述 投票:1回答:1

我尝试将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;
    }

因为不再支持编译。

我尝试同步它时的错误是:错误:找不到类型组织对象上的参数[build_ebny41u4h7onhh3ybv447hi4b $ _run_closure3 $ _closure8 @ 7d0b1f54]的方法com.crashlytics.sdk.android:crashlytics:2.9.9@aar()。 gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。打开文件

我用Google搜索了这个问题但找不到合适的解决方案。谁知道如何处理这个?

android crashlytics google-fabric
1个回答
2
投票

你快到了。只需要用()写这个:

implementation ('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true;
}
© www.soinside.com 2019 - 2024. All rights reserved.