我收到错误:
错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForPaidFreeDebug”执行失败。
java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException:无法合并 dex
添加以下两个依赖后:
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
这是我的所有依赖项:
dependencies {
compile 'com.android.support:multidex:1.0.2'
compile('com.github.florent37:materialviewpager:1.2.0@aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.0'
compile files('libs/droidText.0.2.jar')
compile 'commons-io:commons-io:2.5'
compile 'com.google.code.findbugs:jsr305:3.0.0'
// in app billing
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile 'org.solovyev.android:checkout:1.2.1'
//
compile 'com.github.simbiose:Encryption:2.0.1'
compile 'com.android.support:support-v13:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'me.everything:providers-android:1.0.1'
//dateTime Picker
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
//Date Time
compile 'net.danlew:android.joda:2.9.9'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.github.danysantiago:sendgrid-android:1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
//Logging
compile 'com.jakewharton.timber:timber:4.5.1'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
//Rx
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.8'
//butterknife
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
testCompile 'junit:junit:4.12'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
testCompile 'org.robolectric:robolectric:3.1-rc1'
testCompile 'org.robolectric:shadows-support-v4:3.1-rc1'
testCompile 'org.glassfish:javax.annotation:10.0-b28'
testCompile 'org.mockito:mockito-core:2.0.7-beta'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.robolectric:shadows-multidex:3.1-rc1'
testCompile 'org.assertj:assertj-core:1.7.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
我的默认配置:
defaultConfig {
applicationId "com.webnation.text2email"
minSdkVersion 19
targetSdkVersion 19
multiDexEnabled true
}
我升级了内存,添加了multiDexEnabled,添加了multi-dex的支持库。
有趣的是,我必须添加
exclude 'META-INF/DEPENDENCIES'
为了让它出现 multidex 错误。
我似乎找不到解决办法。
详细错误:
错误:07:48:24.286 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]
07:48:24.286 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] 失败:构建因异常而失败。
07:48:24.286 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]
07:48:24.286 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] * 出了什么问题:
07:48:24.286 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] 任务“:app:transformClassesWithMultidexlistForPaidFreeDebug”执行失败。
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.io.IOException:无法写入[/Users/kristywelsh/Dropbox/SMS2Email1/app/build/intermediates/multi-dex/ paidFree/debug/componentClasses.jar](无法读取[/Users/kristywelsh/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/31fbbff1ddbf98f3aa7377c94d33b0447c646b6e/httpcore-4.3。 2.jar(;;;;;;**.class)] (重复的 zip 条目 [httpcore-4.3.2.jar:org/apache/http/annotation/NotThreadSafe.class]))
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] * 尝试:
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] 使用 --stacktrace 选项运行以获取堆栈跟踪。
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter]
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildExceptionReporter] * 获取更多帮助https://help.gradle.org https://help.gradle.org07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildResultLogger]
07:48:24.287 [错误] [org.gradle.internal.buildevents.BuildResultLogger] 在 34 秒内构建失败
Duplicate zip entry [httpcore-4.3.2.jar:org/apache/http/annotation/NotThreadSafe.class]
您正在从 Gradle 未在其依赖项解析过程中删除的源中获取此 Java 类的两个副本。
一种可能性是您的新依赖项之一具有对 Apache HttpCore 的传递依赖项,但是libs/droidText.0.2.jar
或者您的其他依赖项之一有自己的副本org.apache.http.annotation.NotThreadSafe
.
如果您位于“项目”视图(而不是默认的 Android 视图)中,Android Studio 具有项目树的“外部库”部分:
据我所知,追踪此问题的唯一方法是开始筛选您的库并尝试识别 2+org.apache.http.annotation.NotThreadSafe
。然后,尝试找出如何停止使用其中之一。具有此类的库可能是通过传递依赖关系实现的,因此您还需要确定这些传递依赖关系的来源。这将是痛苦的,这就是为什么我希望较新版本的 Android Studio 在这里会更有帮助 https://issuetracker.google.com/issues/69958400.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)