启用Proguard的运行时崩溃房间持久性库

时间:2018-02-08 10:08:49

标签: android android-studio proguard android-proguard android-room

当启用proguard时,我一直面临着Room room版本的崩溃

FATAL EXCEPTION: main
              Process: <mypackage>.debug, PID: 27841
              java.lang.RuntimeException: Unable to create application <mypackage>.DebugBaseApplication: java.lang.RuntimeException: cannot find implementation for <mypackage>.database.c. c_Impl does not exist
                  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5015)
                  at android.app.ActivityThread.-wrap1(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
                  at android.os.Handler.dispatchMessage(Handler.java:111)
                  at android.os.Looper.loop(Looper.java:207)
                  at android.app.ActivityThread.main(ActivityThread.java:5811)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
               Caused by: java.lang.RuntimeException: cannot find implementation for <mypackage>.database.c. c_Impl does not exist
                  at android.a.c.b.d.a(Unknown Source)
                  at android.a.c.b.e$a.b(Unknown Source)
                  at <mypackage>.database.c.getFuelDatabase(Unknown Source)
                  at <mypackage>.database.b.init(Unknown Source)
                  at <mypackage>.c.onCreate(Unknown Source)
                  at <mypackage>.DebugBaseApplication.onCreate(Unknown Source)
                  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1041)
                  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5012)
                  at android.app.ActivityThread.-wrap1(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5811) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)

这是我的房间配置

## Room
-dontwarn android.arch.util.paging.CountedDataSource
-dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource

以下是build.gradle

中声明依赖关系的方式
// room for local cache
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
implementation "android.arch.persistence.room:rxjava2:1.0.0"

我已经完成了很多关于此的stackoverflow帖子。喜欢 Room Persistence Library run time exception when calling Rooms inMemoryBuilder methodRoom cannot find implementation但事情是我没有使用Kotlin,一切似乎都正确配置给我。我不确定这里的问题,请建议。

0 个答案:

没有答案