Quantcast
Channel: Active questions tagged methodhandle - Stack Overflow
Viewing all articles
Browse latest Browse all 37

Build error "com.android.tools.r8.internal.k2: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O"

$
0
0

I have a module within my app that depends on org.tensorflow:tensorflow-lite:2.15.0 library. This library in turn depends on com.google.inject:guice:5.1.0 which is the source of the build error.

Below is an excerpt from the Build Output

> Task :app:mergeExtDexDebugAGPBI: {"kind":"error","text":"com.android.tools.r8.internal.k2: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)","sources":[{"file":"C:\\Users\\saeed\\.gradle\\caches\\modules-2\\files-2.1\\com.google.inject\\guice\\5.1.0\\da25056c694c54ba16e78e4fc35f17fc60f0d1b4\\guice-5.1.0.jar"}],"tool":"D8"}> Task :app:mergeExtDexDebug FAILEDExecution failed for task ':app:mergeExtDexDebug'.> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.> Failed to transform guice-5.1.0.jar (com.google.inject:guice:5.1.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.> Execution failed for DexingNoClasspathTransform: C:\Users\saeed\.gradle\caches\modules-2\files-2.1\com.google.inject\guice\5.1.0\da25056c694c54ba16e78e4fc35f17fc60f0d1b4\guice-5.1.0.jar.> Error while dexing.

What's baffling to me is that the error showed up about 2 weeks ago after the code has been building fine for almost a year now and no changes have been made to it during this period. Even when I go back to an old commit which I know, for sure works. This build error shows up.

The easiest solution, which is mentioned in the build output, is to increase the minSdk to 26. This is not a desirable solution for me as some of my users are below api level 26.I'd like to avoid going this route as much as possible.

Also, when I set minifyEnable to true, the build is successful but doing that breaks some other parts of the app. I've been searching for a way to set minifyEnable to true for just that module but so far, haven't been successful.


Viewing all articles
Browse latest Browse all 37

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>