简体   繁体   English

如何将我的应用程序与 Firebase Crashlytics 集成? 依赖性问题

[英]How I can integrate my app with Firebase Crashlytics? Problems with dependencies

I have problems with my dependencies, but I did all things from this guide.我的依赖项有问题,但我按照本指南做了所有事情。 And also try to remove dependencies with "exclude" and "useVersion" in Gradle app file.并尝试在 Gradle 应用程序文件中使用“exclude”和“useVersion”删除依赖项。

Build log (You can see dublicated classes from firebase and google-play-services libraries):构建日志(您可以看到来自 firebase 和 google-play-services 库的重复类):

Duplicate class com.google.android.gms.measurement.AppMeasurement$ConditionalUserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Event found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$EventInterceptor found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$OnEventListener found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$Param found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.android.gms.measurement.AppMeasurement$UserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-impl-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-impl:17.4.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-api-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.4.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Event found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-api-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.4.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$Param found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-api-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.4.1)
Duplicate class com.google.firebase.analytics.FirebaseAnalytics$UserProperty found in modules jetified-firebase-analytics-impl-12.0.1-runtime.jar (com.google.firebase:firebase-analytics-impl:12.0.1) and jetified-play-services-measurement-api-17.4.1-runtime.jar (com.google.android.gms:play-services-measurement-api:17.4.1)

My app level Gradle file:我的应用程序级别 Gradle 文件:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'


android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "***"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

   ...

    }


    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    lintOptions {
        abortOnError false
    }
}

...

dependencies {
    implementation fileTree(dir: "${rootDir}/libs", include: ['*.jar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.fragment:fragment-ktx:1.2.4'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'org.osmdroid:osmdroid-android:6.1.6'
    implementation 'org.osmdroid:osmdroid-wms:6.1.6'
    implementation 'org.osmdroid:osmdroid-mapsforge:6.1.6'
    implementation 'org.osmdroid:osmdroid-geopackage:6.1.6'
    implementation 'org.osmdroid:osmdroid-third-party:6.0.1'
    implementation "androidx.preference:preference-ktx:1.1.1"
    //Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesLatestVersion"
    // Koin for Android
    implementation "org.koin:koin-android:$koinVersion"

    // Koin Android Scope features
    implementation "org.koin:koin-android-scope:$koinVersion"
    // Koin Android ViewModel features
    implementation "org.koin:koin-android-viewmodel:$koinVersion"
    // Koin Android Experimental features
    implementation "org.koin:koin-android-ext:$koinVersion"


    implementation project(path: ':data')
    implementation project(path: ':domain')
    implementation project(path: ':maplayoutlib')

    implementation 'com.annimon:stream:1.2.1'
    implementation 'com.google.android.material:material:1.1.0'

    implementation 'com.google.firebase:firebase-analytics:17.4.1'
    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
}

And my project level Gradle file:我的项目级别 Gradle 文件:

buildscript {
    ext.kotlin_version = '1.3.72'
    ext.coroutinesLatestVersion = '1.3.3'
    ext.koinVersion = '2.1.5'

    repositories {
        google()
        jcenter()
        maven {
            url "https://jitpack.io"
        }
    }
    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'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

I hope that you can help me我希望你能帮助我

EDIT:编辑:

Firstly I have the same dependency problem, when add首先我有同样的依赖问题,当添加

implementation 'com.google.firebase:firebase-analytics:17.4.1'

with apply plugin: 'com.google.gms.google-services' .使用apply plugin: 'com.google.gms.google-services'

I solve this problem by using v12.0.1我使用 v12.0.1 解决了这个问题

resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.google.android.gms') {
            details.useVersion '12.0.1'
        }
        if (requested.group == 'com.google.firebase') {
            details.useVersion '12.0.1'
        }
    }

It was working before I add dependency on crashlytics在我添加对 crashlytics 的依赖之前它一直在工作

    apply plugin: 'com.google.firebase.crashlytics'
    ...

    implementation 'com.google.firebase:firebase-crashlytics:17.0.0'

You can see this version of my gradle files upper上面可以看到我的这个版本的gradle文件

Firebase Crashlytics should start working from the second you add it to the project. Firebase Crashlytics 应该从您将其添加到项目的那一刻开始工作。 No other implementation is needed.不需要其他实现。 Your gradle files looks fine to me, but try changing the first line in app-level Gradle file to this:您的 gradle 文件对我来说看起来不错,但请尝试将应用级 Gradle 文件中的第一行更改为:

implementation fileTree(dir: 'libs', include: ['*.jar'])

and updating crashlytics dependency in project-level Gradle file to v2.1.1并将项目级 Gradle 文件中的 crashlytics 依赖项更新为 v2.1.1

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我无法访问我的 Firebase Crashlytics 仪表板 - I can't access my Firebase Crashlytics Dashboard 如何使用 Firebase Crashlytics 对 Flutter 应用程序中的 Java 堆栈跟踪进行反混淆 - How to deobfuscate Java stacktrace in Flutter app with Firebase Crashlytics Flutter App如何在Firebase中集成身份验证和数据库? - How to integrate authentication and database in Firebase for Flutter App? 如何从 TypeScript 中的可调用 Firebase Cloud Function 向我的 Unity 应用程序发送自定义 object? - How can I send custom object from my callable Firebase Cloud Function in TypeScript to my Unity app? 如何将我的应用程序从 firebase 获取的数据设置到我的 bottomSheetView? (科特林) - How can I set the fetched data of my app from firebase to my bottomSheetView? (Kotlin) Firebase Crashlytics for Android app without inte.net connection - Firebase Crashlytics for Android app without internet connection Firebase Crashlytics 不与我的 android 项目同步 - Firebase Crashlytics do not sync with my android project 我可以同时使用 jcenter() 和 mavenCentral() 在我的应用程序中实现 Firebase 吗? - Can I use both jcenter() and mavenCentral() to implement Firebase in my app? Firebase:如何在应用检查中注册我的 Flutter 应用? - Firebase: How do I register my Flutter app in app check? 如何将动态 IP 地址添加到 Google Cloud 中的“授权 javascript 来源”列表中,以便将 Google 登录集成到我的 web 应用程序中? - How can I add a dynamic IP address to the "Authorised javascript origins" list in Google Cloud so that I can integrate Google sign-in into my web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM