Migrate to the new kotlin-parcelize

That's a bug in kapt and it's reported here. Actually the java code you posted is a stub class which generated by kapt to run annotation processors on it (as you can see, there is no real implementation, just the structure and annotations). So as a workaround you can move the code with @Parcelize annotations to a separate module where you don't have kapt enabled. kotlin-parcelize itself does not use annotation processors to generate code, it uses a compiler plugin to emit the IR directly I believe.

Update: the issue is fixed in kotlin 1.5


This is work for me, please check the order of lines carefully

plugins {
    id 'kotlin-android'
    id 'kotlin-parcelize'
    id 'kotlin-kapt'    
   }

After further checking, I think Parcelable generic type with Parcel constructing fails to compile because T class can not be determined generically based from this reference.

enter image description here

Perhaps an enum could be the last resort.