在我的应用程序中我想使用Room
使用库database,最后为生成APK我启用minify选项 (proguard) in Build.Gradle
.
我使用以下版本的 Room 库:
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
我在 proguard-rules 中编写以下代码:
-dontwarn class android.arch.persistence.room.paging.LimitOffsetDataSource
-dontwarn interface android.arch.persistence.room.paging.LimitOffsetDataSource
-dontwarn class android.arch.util.paging.CountedDataSource
-dontwarn interface android.arch.util.paging.CountedDataSource
但是当生成 APK 时显示以下错误Build
tab :
Unknown option 'android.arch.persistence.room.paging.LimitOffsetDataSource' in line 39 of file '/Volumes/M/Test Projects/MyApp/app/proguard-rules.pro'
显示此行的错误:
-dontwarn class android.arch.persistence.room.paging.LimitOffsetDataSource
如何解决这个问题?
如果你使用androidx
-keep class * extends androidx.room.RoomDatabase
-keep @androidx.room.Entity class *
-dontwarn androidx.room.paging.**
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)