gpt4 book ai didi

android - 与android gradle项目冲突

转载 作者:行者123 更新时间:2023-11-30 03:03:37 26 4
gpt4 key购买 nike

从今天早上开始,我尝试在 android studio 中管理来自 gradle 的错误,但我无法解决它。

这是错误:

Gradle tasks [:app:assembleDebug]
UNEXPECTED TOP-LEVEL EXCEPTION:
1 error
0 warnings
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\AndroidIDES\sdk\build-tools\19.0.1\dx.bat --dex --output C:\PMSL\Patovideos\app\build\dex\debug C:\PMSL\Patovideos\app\build\classes\debug C:\PMSL\Patovideos\app\build\dependency-cache\debug C:\PMSL\Patovideos\app\build\pre-dexed\debug\classes-d5d5a5f0ee3aa349db97373276cdf4ce1d756400.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\support-v4-19.0.1-4d62c5c6d8c8b8a26f02df44b7278821a9f5af4b.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-a1273e57a1a8b916291dfb13a6906d801ad6594f.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-javadoc-a86f634bf1d1005314ba37126bfafdad8f979c7c.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-sources-c2bc28216be226462ec688d3a3cc65fb947e01c5.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-with-sources-699e086d09eb3ee375070763bee8e42cdcacabc4.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nostra13/universalimageloader/cache/disc/DiscCacheAware;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)

这是build.gradle

apply plugin: 'android'

android {
compileSdkVersion 18
buildToolsVersion '19.0.1'

defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

哪里出错了??请帮助我......我正在撕扯我的头发

最佳答案

该错误意味着它在构建时试图在您的 APK 中包含类 com.nostra13.universamimateloader.cache.disc.DiscCacheAware 两次。我不确定这个类是从哪里来的;如果它在您的资源中,请确保您没有以某种方式将它放在那里两次。如果它是一个库依赖项,那么您的 libs 文件夹中可能有两个包含此类的 jar - 查看它们并确保您没有在某处将其加倍。

如果您一直在更改依赖项和库,则构建可能处于错误状态,执行清理和重建将修复它。这可能不是问题所在,但可以快速尝试。

关于android - 与android gradle项目冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22177610/

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