错误JSON.simple:java.util.zip.ZipException:重复项:组织/ hamcrest / BaseDescription.class [英] Error JSON.simple: java.util.zip.ZipException: duplicate entry: org/hamcrest/BaseDescription.class

查看:1308
本文介绍了错误JSON.simple:java.util.zip.ZipException:重复项:组织/ hamcrest / BaseDescription.class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我加入JSON.simple,使MultiDex并获得以下错误后面临着在Android Studio中的一个问题:

I am facing a problem in android studio after adding JSON.simple and enabling MultiDex and get the following error:

错误:执行失败的任务:应用程序:packageAllDebugClassesForMultiDex。
   java.util.zip.ZipException:重复项:组织/ hamcrest / BaseDescription.class

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: org/hamcrest/BaseDescription.class

下面是我的build.gradle:

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'
}

感谢您。

变更编译com.google code.json简单的:JSON-简单:1.1.1 编译('COM 。谷歌code.json简单的:JSON-简单:1.1.1'){排除组:org.hamcrest',模块:'hamcrest芯'}

感谢您凯恩O'Riley!

Thank you Kane O'Riley!

推荐答案

更改 JSON-简单导入排除这样的hamcrest依赖性:

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'
}

依赖关系这将prevent多个副本被包括在内。

This will prevent multiple copies of the dependency being included.

这篇关于错误JSON.simple:java.util.zip.ZipException:重复项:组织/ hamcrest / BaseDescription.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆