0

I'm facing some issues when compiling the release version of my app.

I'm currently using Room and I have my model classes are under:

com.example.room.entity

and in order to let the app working I'm using a proguard rule

-keepattributes *Annotation*,SourceFile,LineNumberTable
-keep class com.example.room.entity.**.* { *; }

Once I build the version and I execute on my phone the app crash and I can see

Caused by java.lang.ClassNotFoundException com.roommate.example.room.entity.UserEntity

The output of -printusage shows me that the the class I'm trying to preserve is somewhat touched by R8.

What can I do to enforce my rules?

1 Answers1

0

Try to change second line to:

-keep class com.roommate.example.room.entity.** { *; }
  • So the problem could be the final .* part? There is a particular reason? – Matteo Bucci Sep 18 '20 at 15:41
  • @MatteoBucci Ah, no, the problem is that you're keeping the classes in `-keep class com.example.room.entity.**.* { *; }` whereas your code is actually living in `com.roommate.example.room.entity.UserEntity` (note the com.roommate at the start, as opposed to com.example...) – Mikael Ohlson Mar 01 '22 at 13:50