Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.android.tools.r8.CompilationFailedException:Compilation failed to complete, position:Lcom/facebook/login/DefaultAudience$EnumUnboxingLocalUtility;

I have some error, after updated kotlin version (ext.kotlin_version) to 1.6.10:

com.android.tools.r8.internal.E00: Unexpected type in conversion to primitive: OBJECT

Execution failed for task ':app:minifyReleaseWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Lcom/facebook/login/DefaultAudience$EnumUnboxingLocalUtility;getNativeProtocolAudience(I)Ljava/lang/String;, origin: ..\.gradle\caches\transforms-3\57102c4e3d32396b86898e5ca0dd620d\transformed\jetified-facebook-core-7.1.0-runtime.jar:com/facebook/login/DefaultAudience.class

It happened, if I use options minifyEnabled true in my build.gradle(:app) with Generate signed bundle. If I use old ext.kotlin_version (for examle, 1.5.0) this error did not appear.

I think, if I use correct rule(s) in proguard-rules.pro I could resolve this issue.

like image 367
Alex Avatar asked Apr 15 '26 08:04

Alex


2 Answers

This was caused by an issue in R8. Fix is available in R8 3.1.71, 3.2.55 and 3.3.26-dev versions.

Add the following to settings.gradle or settings.gradle.kts to use a specific version of R8 different from the one bundeled with AGP:

pluginManagement {
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url = uri("https://storage.googleapis.com/r8-releases/raw")
            }
        }
        dependencies {
            classpath("com.android.tools:r8:X.Y.Z")
            classpath('com.google.guava:guava:30.1.1-jre')  // <-- THIS IS REQUIRED UNTIL R8 3.2.4-dev
        }
    }
}
like image 156
sgjesse Avatar answered Apr 16 '26 22:04

sgjesse


In my case i just changed minSdkVersion from 23 to 27 in app.gradle file it fixed.

like image 37
Gyan Avatar answered Apr 16 '26 20:04

Gyan