当我添加rt.jar时,“原因:com.android.builder.dexing.DexArchiveBuilderException:无法处理”

时间:2019-12-18 00:50:55

标签: java android

我的Android项目需要sun库。我知道即使在jdk中也无法使用该库,因此我手动添加了rt.jar。

enter image description here

当我运行它时,出现一些错误。有谁知道导致此错误的原因以及解决方案?

MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
Message{kind=ERROR, text=MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26), sources=[Unknown source file], tool name=Optional.of(D8)}
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process D:\belajarrubik\app\libs\rt.jar
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException

这是我的构建毕业应用程序代码

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.example.user.belajarrubic"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation files ('libs/rt.jar')
    implementation files ('libs/CGcoba.jar')
    implementation files ('libs/junit-4.12.jar')
    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'
}

0 个答案:

没有答案