https://kotlinlang.org logo
#android
Title
# android
t

tschuchort

08/17/2017, 12:17 PM
anyone here using the
@Parcelize
annotation from the 1.1.4 android extensions? It doesn't seem to work for me, I always get a compiler error:
error: cannot find symbol CREATOR = null
k

kingsley

08/17/2017, 12:36 PM
Did you apply the
kotlin-android-extensions
plugin? And enable experimental extensions?
It works just fine for me. True, there are issues with it. But non of this kind
t

tschuchort

08/17/2017, 1:02 PM
I did. What kind of issues are you having?
can you post your build.gradle and an example how you use it?
@kingsley
s

sashjakk

08/17/2017, 1:07 PM
try to update plugin for android studio simple smile
1
k

kingsley

08/17/2017, 1:07 PM
I haven’t done anything differently. Build.gradle has this:
Copy code
apply plugin: 'kotlin-android-extensions'

androidExtensions {
    experimental = true
}
And I use like this:
Copy code
@Parcelize
class User(val firstName: String, val lastName: String) : Parcelable
Issues: 1. Generated code doesn’t currently take nullability into consideration 2. There’s currently no way to specify custom serializers, you’d have to resort to doing the whole thing manually But of course, it’s the initial release and it’s still experimental, so this is okay
t

tschuchort

08/17/2017, 1:14 PM
weird, I do exactly the same. But it doesn't work neither with the simplest data classes nor normal classes
k

kingsley

08/17/2017, 2:20 PM
Did you update your Android Studio plugin? ^^ Also try to build directly with gradle see if it makes any difference