将androidx.appcompat:appcompat
更新为1.5.0
版本后出错
错误:
Duplicate class androidx.lifecycle.ViewModelLazy found in modules lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)
Go to the documentation to learn how to Fix dependency resolution errors.
build.gradle:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.ewrqgbwer.android"
minSdkVersion 24
targetSdkVersion 32
versionCode 5
versionName "1.1.4.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
packagingOptions {
resources.excludes.add("META-INF/*")
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:28.1.0')
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.play:core:1.10.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-analytics:21.1.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.12'
implementation 'com.google.android.gms:play-services-ads:21.1.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.firebase:firebase-messaging:23.0.7'
implementation 'com.google.firebase:firebase-inappmessaging-display:20.1.2'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.code.gson:gson:2.8.9'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
发布于 2022-08-18 13:35:11
我翻遍了所有的库,结果发现问题是一个过时的com.google.firebase:firebase-bom:28.1.0
版本。
https://stackoverflow.com/questions/73403879
复制相似问题