java Android Studio 3.0 DexArchiveBuilderException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47137483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio 3.0 DexArchiveBuilderException
提问by Rafael Ruiz Mu?oz
I'm having this error whilst compiling Instrumentation tests.
我在编译 Instrumentation 测试时遇到了这个错误。
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/rafaelruizmunoz/SourceTree/Weather/app/build/intermediates/transforms/desugar/androidTest/debug/1.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/assertj/core/api/LongPredicateAssert.class
Error:com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24
错误:com.android.builder.dexing.DexArchiveBuilderException:无法处理/Users/rafaelruizmunoz/SourceTree/Weather/app/build/intermediates/transforms/desugar/androidTest/debug/1.jar
错误:com.android.builder.dexing.DexArchiveBuilderException:dexing org/assertj/core/api/LongPredicateAssert.class 时出错
错误:com.android.dx.cf.code.SimException:未使用 --min-sdk-version >= 24 的默认或静态接口方法
I tried to enable/disable multiDexEnabled
in my build.gradle
but nothing helped.
我试图启用/禁用multiDexEnabled
我的build.gradle
但没有任何帮助。
My android
of build.gradle
:
我android
的build.gradle
:
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.**.weather"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
回答by Sunny
In gradle.properties
add android.enableD8=true
This should work.
在gradle.properties
添加android.enableD8=true
这应该工作。
Please note that there is a known bug when you export and upload the apk to play store with d8 enable. The app will not run on some devices when downloaded from play store.
请注意,当您在启用 d8 的情况下将 apk 导出并上传到 Play 商店时存在一个已知错误。从 Play 商店下载时,该应用程序将无法在某些设备上运行。
回答by AmirahmadAdibi
I just have the same error for me, it was because of okhttp and I downgrade implementation of it form:
我只是有同样的错误,这是因为 okhttp 并且我降级了它的实现形式:
to this:
对此:
implementation "com.squareup.okhttp3:okhttp:3.12.1"
回答by Diego Plentz
If you're using guava, tou can try to upgrade it to the latest android-specific build
如果您使用的是番石榴,您可以尝试将其升级到最新的 android 特定版本
implementation 'com.google.guava:guava:23.0-android'
This fixed the error for me when I was using the non-android guava build.
当我使用非 android 番石榴构建时,这为我修复了错误。
回答by manish
With latest android studio 3.2 and gradle, we can also resolve it via
使用最新的android studio 3.2和gradle,我们也可以通过
implementation 'com.android.support:multidex:1.0.3' in app build.gradle
回答by Nagaraj Wadakannavar
I have had the same issue and I resolved it by disabling the advanced profiling in run configuration.
我遇到了同样的问题,我通过在运行配置中禁用高级分析来解决它。
Edit Configurations -> app -> Profiling -> Enable advanced profiling (Uncheck this option).
编辑配置 -> 应用程序 -> 分析 -> 启用高级分析(取消选中此选项)。
回答by Null Pointer Exception
add these line to your gradle:
将这些行添加到您的 gradle 中:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}