在添加 JSON.simple 并启用 MultiDex 后,我在 Android Studio 遇到了问题,并出现以下错误:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: org/hamcrest/BaseDescription.class
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.MildlyGoodApps.EffortlessDescriptions"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.android.support:multidex:1.0.0'
}
谢谢。
已修改:
将compile 'com.googlecode.json-simple:json-simple:1.1.1'
更改为compile('com.googlecode.json-simple:json-simple:1.1.1'){ exclude group: 'org.hamcrest', module: 'hamcrest-core' }
.
谢谢Kane O'Riley!
libs
目录中有哪些JAR文件? - Kane O'Riley./gradlew -q api:dependencies --configuration compile
并将输出结果发布吗?另外,请尝试将json-simple
的编译指令更改为以下形式:compile('com.googlecode.json-simple:json-simple:1.1.1') { exclude group: 'org.hamcrest', module: 'hamcrest-core' }
- Kane O'Riley