java - 错误: multiple files define Lorg/json/simple/ItemList

标签 java android android-studio gradle android-gradle-plugin

每当我尝试为我的项目构建 APK 时,都会收到以下错误:

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/json/simple/ItemList;

构建.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "my.package.here"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'org.apache.clerezza.ext:org.json.simple:0.4'
    compile 'com.android.support:design:23.2.0'
}

我认为这意味着不止一个依赖项定义了 ItemList。我知道一个是 org.json.simple,另一个是什么?

如何正确地将 ItemList 从其中之一中排除?

我的 libs 文件夹中没有任何内容,所以这不是问题

最佳答案

替换此编译'org.apache.clerezza.ext:org.json.simple:0.4'

compile('com.googlecode.json-simple:json-simple:1.1.1') {
    exclude group: 'org.hamcrest', module: 'hamcrest-core'
}

来源在这里:click link

关于java - 错误: multiple files define Lorg/json/simple/ItemList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36069142/

相关文章:

android - 在 Android Studio 中调试 Android BroadcastReceiver onReceive() 方法

java - 通过用于 selenium 测试的简单 acl 身份验证来阻止

android - 为什么 Project/Properties/Android 在 Eclipse 中不起作用?

android - Android 应用程序 Azure 依赖项 gradle 构建时出错

android-studio - Android Studio - 如何更改 Android SDK 路径

安卓工作室 : Error: SplashActivity is not an Activity subclass or alias

java - 为什么在Java中的compare(float float1, float float2)中使用>、<和==?

Java GUI 不显示在 Ubuntu 上的 Eclipse 中

java - Jackson 调用 setter 但嵌套对象的字段仍为空

java - 如何从 native 模块触发事件