Sitemap

softAai Blogs

Explore in-depth insights on Kotlin, Android, Java, DSA, Design Patterns, Architectures, AI/ML, and Automotive/IVI. Discover best practices and knowledge all in one place: https://softaai.com/

ProGuard, R8 and Reverse Engineering Protection

4 min readMar 17, 2023

ProGuard is a tool used in Android development to optimize and obfuscate code. It’s an optimization tool that can remove unused code and shrink the size of the application. It also helps to make the code difficult to understand or reverse-engineer by renaming classes, methods, and fields, which is called obfuscation.

ProGuard comes with a set of default rules that are applied to the code during the build process. However, developers can also define their own rules for specific classes, methods, or fields. The rules are defined in a ProGuard configuration file, usually named proguard-rules.pro, which is located in the app module of the Android project.

Here are some examples of ProGuard rules:

  1. Keep a specific class:
-keep class com.example.MyClass { *; }

This rule ensures that the class com.example.MyClass is not removed during the optimization process.

2. Keep a specific method:

-keepclassmembers class com.example.MyClass {
public void myMethod(java.lang.String);
}

This rule ensures that the method myMethod in the class com.example.MyClass is not removed during the optimization process.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web
Already have an account? Sign in
softAai Blogs

Published in softAai Blogs

Explore in-depth insights on Kotlin, Android, Java, DSA, Design Patterns, Architectures, AI/ML, and Automotive/IVI. Discover best practices and knowledge all in one place: https://softaai.com/

amol pawar

Written by amol pawar

Senior Android Developer | Software Engineer Find me at https://softaai.com/

No responses yet

Unknown user

Write a response

Recommended from Medium

See more recommendations