Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin Parceler:找不到io.realm.RealmList类型的读/写生成器_Kotlin_Realm_Parceler - Fatal编程技术网

Kotlin Parceler:找不到io.realm.RealmList类型的读/写生成器

Kotlin Parceler:找不到io.realm.RealmList类型的读/写生成器,kotlin,realm,parceler,Kotlin,Realm,Parceler,我的应用程序需要使用领域列表属性打包一些对象。这就是错误: /StudioProjects/ML/dat core android/datcorelibrary/build/tmp/kapt3/stubs/release/com/ret/datcorelibrary/model/UserTest.java:29:错误:Parceler:找不到com.retoglobal.datingcorebrary.model.UserTest的io.RealmList类型的读/写生成器 可在以下主要类别中找

我的应用程序需要使用领域列表属性打包一些对象。这就是错误:

/StudioProjects/ML/dat core android/datcorelibrary/build/tmp/kapt3/stubs/release/com/ret/datcorelibrary/model/UserTest.java:29:错误:Parceler:找不到com.retoglobal.datingcorebrary.model.UserTest的io.RealmList类型的读/写生成器

可在以下主要类别中找到:

用户测试类

@Parcel(implementations = arrayOf(UserTestRealmProxy::class),
        value = Parcel.Serialization.BEAN)

@RealmClass
open class UserTest(

    @PrimaryKey open var id: String = "",
    open var years : Int = 0,
    @SerializedName("profile_photo") open var profilePhoto: ProfilePhoto? = ProfilePhoto("www", "fd"),
    open var location : Property? = null,
    open var town : String? = "",
    open var username : String? = "") : RealmObject()
{

    @ParcelPropertyConverter(RealmUserTestParcelConverter::class)
    open var photos : RealmList<ProfilePhoto>? = null
    set

}

class RealmUserTestParcelConverter : RealmListParcelConverter<ProfilePhoto>() {

    override fun itemFromParcel(parcel: android.os.Parcel?): ProfilePhoto {
        return Parcels.unwrap(parcel?.readParcelable<Parcelable>(ProfilePhoto::class.java.classLoader))

    }

    override fun itemToParcel(item: ProfilePhoto?, parcel: android.os.Parcel?) {
        parcel?.writeParcelable(Parcels.wrap(ProfilePhoto::class.java, item), 0)
    }


}
@Parcel(implementations = arrayOf(ProfilePhotoRealmProxy::class),
        value = org.parceler.Parcel.Serialization.BEAN)
@RealmClass
open class ProfilePhoto(
        @SerializedName("m") open var photo : String = "",
        open var id : String = "") : RealmObject()
更新 RealmListParcelConverter

abstract class RealmListParcelConverter<T:RealmObject> : CollectionParcelConverter<T, RealmList<T>>() {

override fun createCollection(): RealmList<T> {
    return RealmList<T>()
}
}
抽象类RealmListParcelConverter:CollectionParcelConverter(){
重写趣味createCollection():RealmList{
返回RealmList()
}
}

@EpicPandaForce建议的方法有效。我从Github存储库添加了RealMListParceleConverter,并在受影响的类上添加了
注释@Parcel(implementations=arrayOf(ProfilePhotoRealmProxy::class))

您缺少
RealmListParcelConverter
抱歉,已更新!!试试这个方法,我会让你知道的!非常感谢!!!你的转换器看起来怎么样?我正在尝试同样的方法,但总是失败,只有一个例外:代码生成没有成功完成