错误:仅从Android O(--min-api 26)开始支持Invoke-customs [英] Error: Invoke-customs are only supported starting with Android O (--min-api 26)
问题描述
我最近开始学习如何通过Android Studio对Android设备进行编程.直到今天早上我升级到Android Studio 3.4之前,我的第一个应用程序运行良好.
I have recently started learning how to program Android devices via Android Studio. My first app was running fine until I upgraded to Android Studio 3.4 this morning.
我遇到以下编译错误:
原因:com.android.builder.dexing.DexArchiveBuilderException:无法处理C:\ Users \ Technical.gradle \ caches \ transforms-2 \ files-2.1 \ 4f3f8638c6a9f961dae488a0387efb6b \ jars \ classes.jar
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Technical.gradle\caches\transforms-2\files-2.1\4f3f8638c6a9f961dae488a0387efb6b\jars\classes.jar
起因:com.android.builder.dexing.DexArchiveBuilderException:解密时出错.
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
原因:com.android.tools.r8.CompilationFailedException:编译无法完成
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
原因:com.android.tools.r8.utils.AbortException:错误:仅从Android O(--min-api 26)开始支持调用自定义
Caused by: com.android.tools.r8.utils.AbortException: Error: Invoke-customs are only supported starting with Android O (--min-api 26)
是否可以恢复到以前的Android Studio版本?
Is there a way of reverting back to my previous version of Android Studio?
如果新版本中没有发生什么更改而导致创建dex文件失败?
If not what has changed in the new version that is causing a failure in creating the dex file?
我尝试按照建议此处在gradle.properties
中添加android.enableD8=true
没有运气.
I have tried adding android.enableD8=true
in gradle.properties
as suggested here but no luck.
编辑#1:
还已将multiDexEnabled true
添加到应用程序build.gradle
文件中的默认配置,但是仍然存在相同的编译错误.
Have also tied adding multiDexEnabled true
to the default configuration in the app build.gradle
file but the same compilation errors persist.
该构建文件已满...
That build file in full...
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'
}
推荐答案
尝试将以下内容添加到app/build.gradle
中,以使您的Android项目编译与 Java 8 兼容.
Try to add below to your app/build.gradle
to make your Android project compilation be compatible with Java 8.
android {
....
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
....
}
这篇关于错误:仅从Android O(--min-api 26)开始支持Invoke-customs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!