Home > other >  The android - AIDL Parcelize annotation: incompatible types: unable to convert objects to MyCustomOb
The android - AIDL Parcelize annotation: incompatible types: unable to convert objects to MyCustomOb

Time:10-25

I'm on my model class rewritten as Kotlin, it must be Parcelable and used in the AIDL:

@ Parcelize
The data class MyCustomObject (val value1: String, val value2: String) : Parcelable

During compilation, it collapsed and there is an error:


Error: incompatible types: Object always be converted to MyCustomObject

And in the generated code to visit:

If ((0!=_reply. ReadInt ())) {
_result=com. Mypackagename. MyCustomObject. CREATOR. CreateFromParcel (_reply);
}

I use the comments for other purposes and it doesn't matter, only I found so far in the AIDL mismatch.
What idea is there anything wrong?
Editor: 5 days later without any comment I created a ticket for this issue.

CodePudding user response:

This is Kotlin a mistake, so I will this question redirect to JetBrains. You can track it here: KT - 25807.
This happens because createFromParcel () does not return T, but returns Object.
After the update source, I will update the answer.

CodePudding user response:

Meet the same problem
  • Related