[英]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.