Android Jetpack’s Navigation component is the modern solution for navigating between screens in Android apps. It supports both activities and fragments (including dialogs). What is more, it allows to pass data to destinations.
Unfortunately there is a snag. If you read documentation carefully you’ll find the Proguard considerations section. So every time you use non-primitive argument types you have to remember to either annotate its classes with
@Keep annotation or add corresponding
-keepnames rules to Proguard/R8 configuration (of course if you don't obfuscate your code then this problem is irrelevant but most apps are obfuscated).
However, it’s not a perfect solution…
The benefits of modularing our apps have been echoed a lot in the community and by Google itself. Here I would like to discuss how we should look into handling Proguard/R8 rules files in this new world.
Generally, developers tend to maintain their Proguard rules file in their application module. This is mostly okay if the modules are only consumed by one application. But what if those modules are shared across multiple apps? Like at Viki, where most of our modules have code that is used in both TV and mobile apps. With shared modules across apps, changes in our…
(I am not going into the level of How to steps for ProGuard. Instead I am jumping directly to talk about some interesting facts that I have learned about ProGuard throughout my experience. So, I assume, most of you know — How to steps about ProGuard in Android).
The fun part of being a developer is building stuffs that make daily life simple. As an android developer who never use any third-party crash reporting tool, every time I publish an app or any update, I had to upload the Pro-Guard mapping file to the server manually. So I made a Custom Gradle Task that would help me get rid of this junk work.
Custom Gradle Task:
Gradle allows us to define our own custom tasks. We can define some cool tasks to customize the gradle build process.
Here is the very simple gradle task to print “Hello World”…
The (retired) Pub(lication) for Android & Tech, focused on Development