Android Room Persistence Library Proguard配置 [英] Android Room Persistence Library Proguard Configuration

查看:117
本文介绍了Android Room Persistence Library Proguard配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android Room Persistence Library 1.0.0-alpha5. 使用ProGuard进行编译时,出现以下错误.

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.

我的Room ProGuard配置"如下

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

我需要帮助解决此错误.我相信在Alpha 3之前不需要ProGuard配置,并且我没有测试Alpha 4

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

推荐答案

您可以在proguard中添加以下行,而不是keep

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

这篇关于Android Room Persistence Library Proguard配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆