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

alaershov

10/24/2023, 7:36 AM
Is there a way to see the
Parcelable
code, generated by
kotlin-parcelize
plugin, directly in Android Studio? I can't see it with "Show Kotlin Bytecode", and I don't want to build the whole APK and decompile it.
e

Eugen Martynov

10/24/2023, 7:54 AM
usually generated code is placed in build folder. Check
build\generaed\source
or somewhere around
👍 1
a

alaershov

10/24/2023, 7:56 AM
I've got an answer in another chat: • you can go to
/build/tmp/kotlin-classes/
in the same gradle module where your class is contained • then you find your compiled class • then in the Studio menu press
Tools/Kotlin/Decompile to Java
Works like a charm!
e

Eugen Martynov

10/24/2023, 7:58 AM
Great! That is decompilation, I wonder if the generated source is also available. But it is off topic
a

alaershov

10/24/2023, 7:59 AM
AFAIK this code generation does not generate source code directly, it gets compiled on the fly, but indeed, this is a different issue)
e

Eugen Martynov

10/24/2023, 8:02 AM
Not an issue but nice optimisation!
c

Chrimaeon

10/24/2023, 11:29 AM
Compiler plugins never generate „source code“ but modify the output.
a

alaershov

10/24/2023, 11:44 AM
Yeah, come to think of it, Parcelize wouldn't even be possible with regular annotation processing, as it requires modification of the initial class. Thanks for the addition)