JR's Week1-2Jan2023 reading digest
Here's a quick post of what I read this week!
Kotlin-Parcelize deep dive by Christophe Beyls
When we want to request an action from an app component in Android, such as Activitiy or Service, we have to use
Intent. When we want to pass a non-primitive object through an
Intent, we can either use the
Serializable interface (Serializable doc) or the
Parcelable interface (Parcelable doc).
The difference is that
Serialize is a java interface, and it's using reflection to infer the serialization process while
Parcelizable requires us to specify it (read). Luckily we have the
kotlin-parcelize plugin provides us with the
@Parcelize that will help to generate the code for us.
In this is a post 👇, Christophe Beyls took a deep dive to examine the generated code by the
How Upgrading to JDK17 for Android Development improves build time
Android runtime ART (previously Dalvik) runs its own bytecode (dex) which is different from standard JVM in Android. This causes the supported Java version in Android development to have always lagged behind the latest Java features. Now JDK17 has become LTS, we can upgrade it to gain the benefits of speeding up our build.
The blog posts below written by Oliver Falvai on Bitrise blog compares the build time of using JDK 11 vs JDK 17 on 3 open source Android Projects Tivi, Firefox Android, DuckDuckGo Android. The blog also examines the effect of different garbage collectors.
In this post, Inaki Villar measures the build for nowinandroid project using JDK11, JDK17 and JDK19:
Both authors are using https://github.com/gradle/gradle-profiler to measure their build.
Since we are talking about Java versions, the following serves as a bonus post to understand the versions!
Codegen with KSP, say goodbye to stubs (kapt)!
In the following video, David Rawson talks about why
ksp is faster than
kapt, and shows us how to use
ksp to write a processor and how to generate code using codegen:
- Video: https://www.youtube.com/watch?v=MMuc5gkKB9s
- Medium post: https://proandroiddev.com/ksp-fact-or-kapt-7c7e9218c575
- Github repo: https://github.com/drawers/ksp-sample
Kotlin's Reduce vs Fold
Chetan Gupta talks about the accumulator pattern reduce and fold in Kotlin:
This video talks about the evolution of code execution in Android from interpreted to JIT, then to Full AOT, then to Partial AOT and eventually with Cloud Profile and Baseline Profile.
Jetpack Compose How Tos
- Philipp Lackner talks about how to use
Textto create an auto resizing
Text, with the help of
- He also showed us how to create a Shimmer effect using
- Another video talking about custom
Clap to support the author, help others find it, and make your opinion count.