gpt4 book ai didi

android - 如何删除通过 gradle 添加的重复库?

转载 作者:搜寻专家 更新时间:2023-11-01 07:55:56 26 4
gpt4 key购买 nike

我在我的项目中使用了两个库。一个是 this另一个是this .

每当我使用编辑测试库运行应用程序时,它都会显示UNEXPECTED TOP-LEVEL EXCEPTION:

Error:Execution failed for task ':mobile:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\Android\me\me\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Project\RemoteiT\RemoteiT\mobile\build\intermediates\dex\debug --input-list=C:\Project\RemoteiT\RemoteiT\mobile\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

我假设上面的错误表明com.nineoldandroids被添加了两次或者冲突。

所以我尝试在 build.gradle 文件中删除它。但它仍然显示错误!

我的假设是否正确?还是我哪里出错了?

Build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "me.aruhan.remt"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.nineoldandroids', module: 'materialDesign'
}

dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile project(':materialDesign')
compile 'com.rengwuxian.materialedittext:library:1.7.1'
}

最佳答案

而不是将其添加到配置中。我只为这样的库添加了排除:

compile ('com.rengwuxian.materialedittext:library:1.7.1') {
exclude group: 'com.nineoldandroids', module: 'library'
}

关于android - 如何删除通过 gradle 添加的重复库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27719436/

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