集成Firebase crashlytics和Fabric依赖关系时,资源重复。

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

我有以下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'
}

和下面的gralde(: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

enter image description here

我试着删除那里提到的文件,但没有用,因为它们被重新添加了,错误又一次次出现。

我不明白冲突在哪里,但两个库似乎在一起不开心。

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

android duplicates crashlytics-android
1个回答
1
投票

顺便说一下

布料是 弃用 并将一直到 2020年5月4日 Crashlytics和Crashlytics Beta已经整合到Firebase中,并提供了新的Firebase-only功能。

不要

 classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
 classpath 'io.fabric.tools:gradle:1.28.0'

// Add the Fabric Crashlytics plugin.
classpath 'io.fabric.tools:gradle:1.31.2'

在您的应用程序级别 build.gradle,添加Crashlytics的依赖关系。

// (Recommended) Add the Google Analytics dependency.
implementation 'com.google.firebase:firebase-analytics:17.4.0'

// Add the Firebase Crashlytics dependency.
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

阅读官方指南 Get started with Firebase Crashlytics.


1
投票

也许我错了,但在我看来,问题在于你同时使用布料和firebase,而据我所知,布料已经不支持了。

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

© www.soinside.com 2019 - 2024. All rights reserved.