Skip to content Skip to sidebar Skip to footer

Dealing With R8 + Jvmstatic Annotation + Lambda In Public Api For Android Library Written In Kotlin

First of all, please note that I'm not expecting why do you want to obfuscate library comments. This is a genuine problem I'm asking about. I have been having an issue dealing with

Solution 1:

This is tracked on the R8 issue tracker http://issuetracker.google.com/158393309 which has more details.

The short story is that this has been fixed in R8 version 2.1.35, which can be used by making the following changes to the top level build.gradle file:

repositories {
    maven {
        url 'https://storage.googleapis.com/r8-releases/raw'
    }
}

dependencies {
    classpath 'com.android.tools:r8:2.1.35'// Must be before the Gradle Plugin for Android.
    classpath 'com.android.tools.build:gradle:X.Y.Z'// Your current AGP version.
 }

Solution 2:

R8 team has fixed this issue along with related issue b/158400283 in R8 version 2.1.42

Fix should already be available in Android Studio 4.1 beta or higher, but if you're using stable Android Studio 4.0 then add following to your top-level build.gradle file:

buildscript {

    repositories {
        maven {
            url 'https://storage.googleapis.com/r8-releases/raw'
        }
    }

    dependencies {
        classpath 'com.android.tools:r8:2.1.42'// Must be before the Gradle Plugin for Android.
        classpath 'com.android.tools.build:gradle:X.Y.Z'// Your current AGP version.
     }
}

Post a Comment for "Dealing With R8 + Jvmstatic Annotation + Lambda In Public Api For Android Library Written In Kotlin"