Obfuscation Parcelable and Serializable for Navigation Component

Last couple of years, as Android Developers we use Navigation Component for navigation structure of our applications or change existing navigation structure to it. Navigation Component provides us the speed to connect screen with each other and setup deep link structure easily.

I don’t tell you everything from the beginning. What is deep link?, What is nav-graph? bla bla . But I just want to pay attention to argType for navigations.

Sometimes we need to use string, integers, long primitive types to pass arguments between screen (Fragments, Activities etc). In some other cases, we need entities to pass into another screen. Before navigation component, we could make this with Bundle and Intents. Actually Navigation Component uses this structure in the background. Here is important, if you want to move entities as arguments to another screen you must inherit your entity classes from Parcelable or Serializable. At this point everything is OK. 👌

You complete your application and want to send to Google Play Store. You should shrink and obfuscate your codes with Proguard or Dexguard. When you use parcelable class as argType for navigation argument, just add below codes into your proguard files, otherwise your application will get a crash 😔.

-keepnames class * extends android.os.Parcelable
-keepnames class * extends java.io.Serializable

Happy coding my friends, I hope this info will help you all.




Oktein Company, Software Engineer, Python Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Implement a Flutter QR Code Scanner Plugin from Scratch

Custom TabLayout Indicator in — Android.

Implementing Dark theme in your Android Application

coin master hack android 2021 | freespinsforcoinmaster.com/generator

How to Integrate Firebase Authentication for Google Sign-in Functionality

Arena of Valor

How to Implement Flutter Barcode Scanner from Scratch

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Oguzhan Alpayli

Oguzhan Alpayli

Oktein Company, Software Engineer, Python Enthusiast

More from Medium

Problem Solving Case: Uber App Rating Dropped

Slingshot UI Suggest

In an Octopus’s Garden

MotAR: An Automobile AR App