没有虚方法getTable()Lio / realm / internal / TableOrView

时间:2016-11-09 14:54:31

标签: java android realm

我正在使用Realm 2.0.2,我收到此错误。 我自定义了RealmBasedRecyclerViewAdapter。 任何的想法 ?

11-09 15:45:11.122 9877-9877/com.codi6.proyect E/AndroidRuntime: FATAL EXCEPTION: main
                                                             Process: com.codi6.proyect, PID: 9877
                                                             java.lang.NoSuchMethodError: No virtual method getTable()Lio/realm/internal/TableOrView; in class Lio/realm/RealmResults; or its super classes (declaration of 'io.realm.RealmResults' appears in /data/data/com.codi6.proyect/files/instant-run/dex/slice-io.realm-realm-android-library-2.1.1_ff7f4a8f1f4f385bcd3dc4aabb40b1b4ad26ff2c-classes.dex)
                                                                 at io.realm.RealmBasedRecyclerViewAdapter.<init>(RealmBasedRecyclerViewAdapter.java:167)
                                                                 at io.realm.RealmBasedRecyclerViewAdapter.<init>(RealmBasedRecyclerViewAdapter.java:133)
                                                                 at io.realm.RealmBasedRecyclerViewAdapter.<init>(RealmBasedRecyclerViewAdapter.java:123)
                                                                 at com.codi6.proyect.adapters.TaskRealmAdapter.<init>(TaskRealmAdapter.java:0)
                                                                 at com.codi6.proyect.activity.MainActivity1.onCreate(MainActivity1.java:88)
                                                                 at android.app.Activity.performCreate(Activity.java:6237)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                 at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

1 个答案:

答案 0 :(得分:2)

ThorbenPrimke library RealmBasedRecyclerViewAdapter'com.github.thorbenprimke:realm-recyclerview:0.9.23')仅更新为Realm 1.1.0。

它未更新为Realm 2.x。

该库还依赖于不再存在的包内部逻辑。

解决方案:请勿使用该库,或将Realm版本还原为1.1.1。

但是,您可以使用Realm-Android-AdaptersRealmRecyclerViewAdapter,1.3.0