首页 > 解决方案 > 集成 Firebase crashlytics 和 Fabric 依赖项时资源重复

问题描述

我有以下 gradle(:app) 文件-

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'io.fabric'


android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.twoverte"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 8
        versionName "1.0.7"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_1_8.toString()
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    //Room components
    implementation 'androidx.room:room-runtime:2.2.5'
    implementation 'androidx.room:room-ktx:2.2.5'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
    kapt 'androidx.room:room-compiler:2.2.5'
    kapt "android.arch.persistence.room:compiler:2.2.5"

    //Lifecycle components
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'

    //Kotlin
    implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72'
    implementation "androidx.core:core-ktx:1.2.0"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha02'

    //Google
    implementation 'com.google.android.gms:play-services-auth:18.0.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:17.4.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'

    //Networking
    implementation 'com.smartarmenia:dotnetcoresignalrclientjava:1.14'
    implementation 'com.microsoft.signalr:signalr:5.0.0-preview.2.20167.3'
    implementation 'com.squareup.retrofit2:retrofit:2.8.1'

    //RxJava + RxAndroid
    implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    implementation 'io.reactivex.rxjava3:rxjava:3.0.0'

    //Gson
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.squareup.retrofit2:converter-gson:2.8.1'

    //Firebase
    implementation 'com.google.firebase:firebase-messaging:20.1.6'

    //Firebase Crashlytics
    implementation 'com.google.firebase:firebase-analytics:17.4.0'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
        transitive = true
    }

    //Permissions
    implementation 'com.karumi:dexter:6.1.0'

    //UI
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:multidex:1.0.3'
    implementation "androidx.viewpager2:viewpager2:1.0.0"
    implementation 'com.google.android.material:material:1.1.0'
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.makeramen:roundedimageview:2.3.0'
    implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
    implementation "androidx.exifinterface:exifinterface:1.2.0"
    implementation 'id.zelory:compressor:3.0.0'
    implementation 'commons-io:commons-io:20030203.000550'
    implementation 'com.libRG:customtextview:2.2'

    //Compression
    implementation 'id.zelory:compressor:3.0.0'

    //Util
    implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC2'
}

以及以下 gradde(:project) 文件 -

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'

        //Firebase Crashlytics
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
        classpath 'io.fabric.tools:gradle:1.28.0'

    }
}

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

    }
}

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

出于某种原因,它给了我一个Duplicate resource错误-

在此处输入图像描述

我试图删除那里提到的文件,但它没有帮助,因为它们被重新添加并且错误一次又一次地出现。

我不明白冲突在哪里,但两个图书馆似乎在一起并不快乐。

试图在这里检查解决方案,但没有任何帮助。

标签: androidduplicatescrashlytics-android

解决方案


我可能错了,但在我看来,问题是您同时使用了fabric和firebase,据我所知,fabric不再受支持

“ Fabric 的未来 我们已将 Fabric 的精华集成到 Firebase 中,为您带来一个强大的应用开发平台。Fabric 已被弃用,现有用户可在 2020 年 5 月 4 日之前使用。新用户应开始使用 Firebase 以利用我们正在那里构建的最新产品和功能。了解更多“


推荐阅读