5

After updating my Android app from Kotlin 1.5.21 to Kotlin 1.6.0, my proguard rules stopped working (i.e. they are ignored). This caused some reflection code to break on release mode. Downgrading to Kotlin 1.5.21 fixes the problem.

Are there any known problems with Kotlin 1.6.0 and proguard ?

Googling around, I see that there are other related problems (see this, this, this).

noe
  • 1,684
  • 1
  • 17
  • 35
  • Please provide a [minimal, complete and verifiable example](https://stackoverflow.com/help/mcve). – dan1st Jan 03 '22 at 18:36
  • Do you use moshi im your project? – dan1st Jan 03 '22 at 18:44
  • Is there an error message? Can you run gradle with a lower log level/in debug mode? This may be worthy of reporting to the maintainers of proguards. – dan1st Jan 03 '22 at 18:50
  • I don't use Moshi. There is no error message whatsoever. I don't have much knowledge about the Android apps build system, but I will try to implement a minimal example. – noe Jan 03 '22 at 19:08

1 Answers1

1

The problem was the version of R8 bundled with the Android Gradle Plugin (AGP).

Following the advice in this related answer, I explicitly set com.android.tools:r8:3.0.77 in my gradle configuration file.

dependencies {
    classpath("com.android.tools:r8:3.0.77")
    classpath 'com.android.tools.build:gradle:7.1.0'
}
noe
  • 1,684
  • 1
  • 17
  • 35