【发布时间】:2019-09-12 17:27:45
【问题描述】:
我最近开始学习如何通过 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: Error: Invoke-customs 仅支持从 Android O (--min-api 26) 开始
有没有办法恢复到我以前的 Android Studio 版本?
如果不是新版本中的哪些更改导致创建 dex 文件失败?
我已尝试按照建议的here 在gradle.properties 中添加android.enableD8=true,但没有运气。
编辑#1:
还将multiDexEnabled true 添加到应用程序build.gradle 文件中的默认配置,但仍然存在相同的编译错误。
完整的构建文件...
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'
}
【问题讨论】:
标签: android android-gradle-plugin