gpt4 book ai didi

android - 如何修复 gradle build for android studio 中的重复类

转载 作者:太空狗 更新时间:2023-10-29 12:59:03 25 4
gpt4 key购买 nike

我正在尝试在 build.gradle 中添加广告。但是,它似乎没有用。

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "br.com.alessanderleite.catchtheballgame"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
}
}
}



dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-ads:9.4.0'
}

错误:

Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-v4:23.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-v4:23.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-v4:23.0.0)

转到文档以了解如何修复依赖项解析错误。

最佳答案

您正在使用

implementation 'com.google.android.gms:play-services-ads:9.4.0'

此版本使用支持库,您不能同时使用 androidx 和支持库。

使用 update version的广告已迁移到 androidx。

implementation 'com.google.android.gms:play-services-ads:18.2.0'

关于android - 如何修复 gradle build for android studio 中的重复类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57760481/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com