fix(proguard): keep no-arg constructor of Room *_Impl classes

R8 in playBenchmark (minifyEnabled) stripped the no-arg <init> from
WorkDatabase_Impl because -keepnames preserves names but not members.
Room instantiates generated *_Impl subclasses reflectively via
Class.getDeclaredConstructor(), so startup crashed with
NoSuchMethodException in androidx.startup.InitializationProvider.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-04-23 13:11:49 +02:00
parent 952d91a1fd
commit ac1b197336
+6
View File
@@ -63,3 +63,9 @@
-keep class com.vitorpamplona.quartz.** { *; }
-keep class com.vitorpamplona.amethyst.** { *; }
-keep class com.vitorpamplona.ammolite.** { *; }
# Room generates *_Impl subclasses instantiated reflectively via no-arg constructor.
# -keepnames preserves the name but R8 still strips the unused <init>().
-keep class * extends androidx.room.RoomDatabase {
<init>();
}