【问题标题】:Trying to add Crashlytics in Android Studio (could not find method...)尝试在 Android Studio 中添加 Crashlytics(找不到方法...)
【发布时间】:2019-03-14 16:32:22
【问题描述】:

我尝试将 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.gradle.api.internal.artifacts.dsl 类型的对象上找不到参数 [build_ebny41u4h7onhh3ybv447hi4b$_run_closure3$_closure8@7d0b1f54] 的方法 com.crashlytics.sdk.android:crashlytics:2.9.9@aar()。依赖项.DefaultDependencyHandler。 打开文件

我在 Google 上搜索了这个问题,但找不到合适的解决方案。 有谁知道怎么处理?

【问题讨论】:

标签: android crashlytics google-fabric


【解决方案1】:

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

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

【讨论】:

  • 我这样做了,但它现在引发了一个新错误:警告:API 'variant.getExternalNativeBuildTasks()' 已过时并已替换为'variant.getExternalNativeBuildProviders()'。
  • 这是警告,根据github.com/firebase/firebase-android-sdk/issues/198 可以忽略。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-24
相关资源
最近更新 更多