首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >更新androidx.appcompat:appcompat后的错误

更新androidx.appcompat:appcompat后的错误
EN

Stack Overflow用户
提问于 2022-08-18 13:25:24
回答 1查看 334关注 0票数 1

androidx.appcompat:appcompat更新为1.5.0版本后出错

错误:

代码语言:javascript
运行
复制
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:

代码语言:javascript
运行
复制
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'
}
EN

回答 1

Stack Overflow用户

发布于 2022-08-18 13:35:11

我翻遍了所有的库,结果发现问题是一个过时的com.google.firebase:firebase-bom:28.1.0版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73403879

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档