Skip to content

How to set proguard rule for Room library on Android

In my application i want use Room library for use database, and for finally for generate APK i enable minify option (proguard) in Build.Gradle .

I use below version of Room library :

implementation ""
annotationProcessor ""

I write below codes in proguard-rules :

-dontwarn class
-dontwarn interface
-dontwarn class android.arch.util.paging.CountedDataSource
-dontwarn interface android.arch.util.paging.CountedDataSource

But when generate APK show me below error in Build tab :

Unknown option '' in line 39 of file '/Volumes/M/Test Projects/MyApp/app/'

Show me error for this line :

-dontwarn class

How can fix this issue?


Add below lines for keep section in your proguard file.

-dontwarn android.arch.util.paging.CountedDataSource