gpt4 book ai didi

android - 原因 : com. android.dex.DexException : Multiple dex files define Lorg/apache/commons/io/IOCase in Studio 3. 0

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:48:35 28 4
gpt4 key购买 nike

我正在开发一个项目。这在 Android studio 2.3.3 上运行良好,但是当我更新我的 Android Studio 3.0 时会发生什么?然后打开我的项目,然后它无法组装,并在错误日志下方发送给我。

错误日志

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/IOCase;
Error:com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/IOCase;
Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/IOCase;

请不要重复,因为我已经尝试了以下所有内容

  • 清理项目
  • 重建项目
  • 重新打开项目并清理和重建后删除项目中的 /.gradle 文件夹
  • 重新打开项目并清理和重建后删除了 .gradle cash 文件夹

其他人认为我检查了下面的堆栈溢出问题及其答案,然后我也没有得到解决方案。

1. Question , 2. Question , 3. Question , 4. Question5. Question

Project level build.gradle file

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

app level build.gradle file

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.mypackage"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

// for render script to create blur image
renderscriptTargetApi 18
renderscriptSupportModeEnabled true

multiDexEnabled true

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.0'
testCompile 'junit:junit:4.12'

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

//google API
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'

//facebook SDK
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile ('org.apache.commons:commons-lang3:3.4'){
exclude module: 'commons-io'
}

compile('net.yazeed44.imagepicker:imagepicker:1.3.0') {
exclude module: 'cam2'
}
}
apply plugin: 'com.google.gms.google-services'

请帮我解决这个问题。我可以知道你是否需要我这边的任何东西。帮助将不胜感激。提前致谢。

最佳答案

我同意 @CommonsWare在您的项目中还有另一个库也包含 commons-io

有一个选项可以解决 gradle 依赖中的这个冲突问题。在您的应用级 build.gralde 文件中添加以下代码。

configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('org.apache.commons:commons-io:1.3.2') with module('commons-io:commons-io:1.3.2')
}
}

原因是为什么 'org.apache.commons:commons-io:1.3.2' 是冲突检查这个堆栈溢出 question's answer .

Note:- To know more about apache commons collections and its different versions check this answer

关于android - 原因 : com. android.dex.DexException : Multiple dex files define Lorg/apache/commons/io/IOCase in Studio 3. 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47015038/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com