我试图将unmano滑动面板库添加到我的android项目中,当我试图运行该项目时,我会得到这个错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:
Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2这是我的依赖项列表:
dependencies {
repositories {
mavenCentral()
}
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile 'com.baoyz.pullrefreshlayout:library:1.0.1'
compile fileTree(dir: 'libs', include: 'gson-*.jar')
compile 'com.parse.bolts:bolts-android:1.2.1'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
compile 'com.sothree.slidinguppanel:library:3.1.1'
}根据我在其他文章中的理解,有一个重复的文件导致了这个构建错误。有人能帮我明白我需要做些什么来解决这个问题吗?如何找到重复的文件?是否有任何gradle命令可用于检测和删除重复项?谢谢
编辑:这是我的lib文件夹内容:
bolts-android-1.2.1.jar
gson-2.3.1.jar
Parse-1.10.0.jar
YoutubeAndroidPlayerApi.jar发布于 2015-09-01 16:23:42
似乎你已经两次包含了同一个库文件
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'gson-*.jar')
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
因此,gson-*.jar和Parse-*.jar似乎包含了两次。
编辑:
正如您所说的,问题在于umano向上滑动库,那么它应该是它的依赖关系问题。
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:support-annotations:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.nineoldandroids:library:2.4.0'
}我检查了com.baoyz.pullrefreshlayout:library,它有以下的依赖项
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.0'
}因此,您包含了两个版本的支持库,因此出现了问题。
compile 'com.baoyz.pullrefreshlayout:library:1.0.1'若要解决此问题,请将上面的一行替换为下面的一行。
compile('com.baoyz.pullrefreshlayout:library:1.0.1') {
{
exclude group: 'com.android.support', module: 'support-v4'
}除上述内容外,请按照下面的指南安装multidex
发布于 2015-09-01 16:26:57
你的第一个依赖
compile fileTree(dir: 'libs', include: ['*.jar'])还有这些
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: 'gson-*.jar')编译相同的图书。首先,在libs文件夹中编译所有的jar文件,其中存储了gson和和Parse。另外两个又添加了gson和Parse库。
因此,简单地删除它们并添加类似的内容。
compile fileTree(dir: 'libs', include: ['*.jar'])
......
compile files('libs/gson-*.jar')
compile files('libs/Parse-*.jar')希望这能有所帮助。
发布于 2015-09-02 03:02:06
使multiDexEnabled在您的build.grade文件中在defaultConfig中变为真。
https://stackoverflow.com/questions/32336454
复制相似问题