Android Studio 3.0 DexArchiveBuilderException [英] Android Studio 3.0 DexArchiveBuilderException
问题描述
我在编译 Instrumentation 测试时遇到此错误.
I'm having this error whilst compiling Instrumentation tests.
错误:com.android.builder.dexing.DexArchiveBuilderException:无法处理/Users/rafaelruizmunoz/SourceTree/Weather/app/build/intermediates/transforms/desugar/androidTest/debug/1.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /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 时出错
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/assertj/core/api/LongPredicateAssert.class
错误:com.android.dx.cf.code.SimException:默认或静态接口方法在没有 --min-sdk-version >= 24 的情况下使用
Error:com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24
我尝试在我的 build.gradle
中启用/禁用 multiDexEnabled
但没有任何帮助.
I tried to enable/disable multiDexEnabled
in my build.gradle
but nothing helped.
我的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
}
}
推荐答案
在 gradle.properties
中添加 android.enableD8=true
这应该可以工作.
In gradle.properties
add android.enableD8=true
This should work.
请注意,当您将 apk 导出并上传到启用 d8 的 Play 商店时,存在一个已知错误.从 Play 商店下载的应用程序将无法在某些设备上运行.
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.
https://issuetracker.google.com/issues/64740479
这篇关于Android Studio 3.0 DexArchiveBuilderException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!