Android Build Error - MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26) (apache poi)

Viewed 316

i'm getting the following error message. Trying to read a xls file using apache poi (version 5.0.0). I'm quit new working with java and android studio so maybe i am just to dumb to see, what went wrong.

hope someone can help me. ^^

(if you need more infos, code or something like this, just ask for it. I'm not sure, what you need to solve my problem.)

Error

> Transform artifact poi-5.0.0.jar (project :poi-5.0.0) with DexingWithClasspathTransform
AGPBI: {"kind":"error","text":"com.android.tools.r8.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)","sources":[{"file":"C:\\Users\\nikla\\AndroidStudioProjects\\controlling_szenario\\poi-5.0.0\\build\\.transforms\\74c17dc26c0bf73dd6362c9c309eb5e9\\jetified-poi-5.0.0.jar"}],"tool":"D8"}

> Task :app:mergeLibDexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeLibDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform poi-5.0.0.jar (project :poi-5.0.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-incremental-transform=false, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: C:\Users\nikla\AndroidStudioProjects\controlling_szenario\poi-5.0.0\build\.transforms\74c17dc26c0bf73dd6362c9c309eb5e9\jetified-poi-5.0.0.jar.
         > Error while dexing.

build.gradle

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.controlling_szenario"
        minSdkVersion 26
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation project(path: ':poi-5.0.0')
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.aldebaran:qisdk:1.7.5'
    implementation 'com.aldebaran:qisdk-design:1.7.5'

}
0 Answers
Related