我尝试通过意图发送一个对象来执行此操作我已经从
修改了我的数据类open class Stream : RealmObject() {
@PrimaryKey
lateinit var id : String
lateinit var detail : String
lateinit var name : String
lateinit var url:String
}
到
open class Stream : RealmObject(), Serializable {
@PrimaryKey
lateinit var id : String
lateinit var detail : String
lateinit var name : String
lateinit var url:String
}
如果类实现Serializable,我们可以使用putSerializableExtra和getSerializableExtra,现在我有Realm初始化的问题
这是我的堆栈跟踪E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.vinaysaripella.funfacts, PID: 7202
java.lang.RuntimeException: Unable to create application com.example.vinaysaripella.funfacts.ServiceModule: io.realm.exceptions.RealmException: Could not initialize the Realm Object Server
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: io.realm.exceptions.RealmException: Could not initialize the Realm Object Server
at io.realm.internal.SyncObjectServerFacade.init(SyncObjectServerFacade.java:60)
at io.realm.Realm.init(Realm.java:249)
at com.example.vinaysaripella.funfacts.ServiceModule.onCreate(ServiceModule.kt:24)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)