每当我尝试为我的项目构建 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/