我最近开始学习如何通过Android Studio编程Android设备。我的第一个应用程序一直运行良好,但今天早上升级到了Android Studio 3.4后出现了问题。
我遇到了以下编译错误:
原因:com.android.builder.dexing.DexArchiveBuilderException: 处理C:\Users\Technical.gradle\caches\transforms-2\files-2.1\4f3f8638c6a9f961dae488a0387efb6b\jars\classes.jar时失败
原因:com.android.builder.dexing.DexArchiveBuilderException: Dexing时出错。
原因:com.android.tools.r8.CompilationFailedException: 编译未能完成
原因:com.android.tools.r8.utils.AbortException: 错误:从Android O开始仅支持Invoke-customs(--min-api 26)
有办法回退到我之前使用的Android Studio版本吗?
如果不行,新版本中改变了什么导致dex文件创建失败?
我尝试在gradle.properties
中添加android.enableD8=true
,如此处所建议,但没有成功。
编辑 #1:
我还尝试在app build.gradle
文件的默认配置中添加multiDexEnabled true
,但仍然出现相同的编译错误。
完整的构建文件如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "qdivision.org.qrtracker"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.felHR85:UsbSerial:6.0.5'
}