Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Room Persistence Library Proguard Configuration

I am using Android Room Persistence Library 1.0.0-alpha5. When compiling with ProGuard I am getting the following error.

Warning:android.arch.persistence.room.paging.LimitOffsetDataSource: can't find superclass or interface android.arch.util.paging.CountedDataSource
Warning:android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.util.paging.CountedDataSource
Warning:android.arch.persistence.room.paging.LimitOffsetDataSource$1: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource
Warning:there were 5 unresolved references to classes or interfaces.
Warning:there were 1 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

My ProGuard Configuration for Room is as follows

-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
# Platform calls Class.forName on types which do not exist on Android to     determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters     and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-keep class android.content.**
-dontwarn android.content.**
-keep class android.animation.**
-dontwarn android.animation.**
-keep class me.panavtec.drawableview.**
-dontwarn me.panavtec.drawableview.**
-keep class javax.annotation.concurrent.**
-dontwarn javax.annotation.concurrent.**
-keep class android.arch.persistence.room.paging.LimitOffsetDataSource
-keep interface android.arch.persistence.room.paging.LimitOffsetDataSource
-keep class android.arch.util.paging.CountedDataSource
-keep interface android.arch.util.paging.CountedDataSource

I need help in fixing this error. I believe ProGuard Configuration was not required prior to Alpha 3 and I did not test alpha 4

like image 680
user3425867 Avatar asked Jul 27 '17 07:07

user3425867


People also ask

What is Room persistence library?

The Room persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite. Latest Update.

What is Roomdatabase?

Room is a persistence library that provides an abstraction layer over the SQLite database to allow a more robust database. With the help of room, we can easily create the database and perform CRUD operations very easily.

Is Room database deprecated?

This method is deprecated. Gets the instance of the given Type Converter. Returns true if current thread is in a transaction. Called by Room when it is initialized.

What are the three components in Room in Android?

While developing an app with Room, we need to implement all of three main components: Entity, Dao, Database.


1 Answers

You can add the following lines in the proguard instead of keep

-dontwarn android.arch.util.paging.CountedDataSource
-dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource
like image 113
VinayagaSundar Avatar answered Sep 21 '22 13:09

VinayagaSundar