Type com.nikolam.nsdkelper.BuildConfig is defined multiple times: /storage/Users/Volks/Desktop/Android-2020/NsdKelper/app/build/intermediates/project_dex_archive/release/out/com/nikolam/nsdkelper/BuildConfig.dex, /storage/Users/Volks/Desktop/Android-2020/NsdKelper/nsdkelper/build/.transforms/6fff326acaa87110e65737aff5d0e0cd/classes/classes.dex
./gradlew test build
输出this我有一个实现LibraryModule的应用程序模块,仅此而已
以下是建议的修复程序
This error typically occurs due to one of the following circumstances:
A binary dependency includes a library that your app also includes as a direct dependency. For example, your app declares a direct dependency on Library A and Library B, but Library A already includes Library B in its binary.
To resolve this issue, remove Library B as a direct dependency.
Your app has a local binary dependency and a remote binary dependency on the same library.
To resolve this issue, remove one of the binary dependencies.
这些是库和应用这两个构建等级的依赖项。
dependencies {
///LIBRARY
implementation fileTree(dir: '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.3.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
///APP
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":nsdkelper")
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
应用程序完整构建版本.gradle https://hastebin.com/dehedobica.php
库完整构建版本.gradle https://hastebin.com/omahuqutuc.nginx
我可以删除直接依赖项并使用JITPACK.io,但我希望将其保留在本地用于开发,我尝试更新依赖项、Gradle版本和降级版本,但似乎没有任何效果。我还删除了一些依赖项,但也没有帮助。我使缓存和类似的常见修复无效,但没有成功。
我试着从App模块中删除依赖项,只实现Library(NsdKelper),但它并不像我想象的那样工作。
A实现了项目B,这意味着A将检查B的依赖项并使用它们。但这里似乎不是这样。从我的应用程序模块中删除依赖项会给我带来丢失库的错误。或者我误解了什么
2条答案
按热度按时间slhcrj9b1#
它们有相同的包ID,在其中一个模块上重命名包解决了这个问题。
xesrikrc2#
在android/build.gradle中添加这个为我解决了这个问题: