@Parcelize causes INSTALL_FAILED_DEXOPT on Android 4


#1

I added @Parcelize to a class and all seems fine on Android 6+ but the app doesn’t install on older devices with Android 4.3 for example.
I have androidExtensions { experimental = true } on gradle.
I have a sample project with just a simple class with one field and it fails to install on a couple of devices with Android 4.3. Removing the annotation and adding the Parcelable code works.

On install, I get a INSTALL_FAILED_DEXOPT. On subsequent installs I sometimes get a INSTALL_FAILED_UID_CHANGED, probably because of the previous error. A reboot usually clears the INSTALL_FAILED_UID_CHANGED and I get the the INSTALL_FAILED_DEXOPT error again.


Where is the @Parcelize documentation?
#2

For what is worth, recently I added this experimental feature to my project and it seemed to work. Today I was willing to build a release build with proguard and it didn’t allow me to build with the following messages:

Warning: com.app.list.adapter.SharingItem$Creator: can't find referenced class com.app.list.adapter.Creator
Warning: com.app.list.adapter.SharingItem$Creator: can't find referenced class com.app.list.adapter.Creator
Warning: com.app.list.adapter.SharingItem$Creator: can't find referenced class com.app.list.adapter.Creator

I decided to remove the annotation and use https://github.com/nekocode/android-parcelable-intellij-plugin-kotlin instead to generate the code. Now proguard didn’t complain.


#3

There’s already an issue in the tracker… https://youtrack.jetbrains.com/issue/KT-20034


#4

I’m using the @Parcelize feature in android development using Kotlin language.

To use them I have done the below modifications in build.gradle file.

apply plugin: ‘kotlin-android-extensions’
then

androidExtensions {
experimental = true
}
I’m successful in using the above feature. But my question is

Does it recommended to use them for production release or only for development purpose alone?