我正在使用realm 2.0.2,我得到了这个错误。
我有一个定制的realmbasedrecyclerviewapter。
知道吗?
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)
最佳答案
ThorbenPrimke
library RealmBasedRecyclerViewAdapter
('com.github.thorbenprimke:realm-recyclerview:0.9.23'
)仅更新到领域1.1.0。
它没有更新到领域2.x。
该库还依赖于不再存在的包内部逻辑。
解决方案:不要使用库,或者将领域版本还原为1.1.1。
但是,您可以使用Realm-Android-Adapters和RealmRecyclerViewAdapter
,1.3.0