I am facing a problem in android studio after adding JSON.simple and enabling MultiDex and get the following error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: org/hamcrest/BaseDescription.class
Here is my 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'
}
Thank you.
Changed compile 'com.googlecode.json-simple:json-simple:1.1.1'
to compile('com.googlecode.json-simple:json-simple:1.1.1'){ exclude group: 'org.hamcrest', module: 'hamcrest-core' }
.
Thank you Kane O'Riley!
Change your json-simple
import to exclude the hamcrest dependency like this:
compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
This will prevent multiple copies of the dependency being included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With