Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between -keep and -keepclassmembers in ProGuard?

I read through http://proguard.sourceforge.net/index.html#manual/usage.html but cannot get their differences.

I tested with 2 different options and decompiled the outcome. Both seems to produce the same result.

-keep class * implements android.os.Parcelable {     *; } 

-keepclassmembers class * implements android.os.Parcelable {     *; } 
like image 852
Cheok Yan Cheng Avatar asked May 10 '13 10:05

Cheok Yan Cheng


People also ask

What is the difference between ProGuard and R8?

R8 is having a faster processing time than Proguard which reduces build time. R8 gives better output results than Proguard. R8 reduces the app size by 10 % whereas Proguard reduces app size by 8.5 %. The android app having a Gradle plugin above 3.4.

What is ProGuard Android TXT?

ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size of your Android application as well as removing unused classes and methods that contribute towards the intrinsic 64k method limit of Android applications.

What is ProGuard obfuscation?

ProGuard is a command-line tool that reduces app size by shrinking bytecode and obfuscates the names of classes, fields and methods. It's an ideal fit for developers working with Java or Kotlin who are primarily interested in an Android optimizer.

What is means for ProGuard?

ProGuard is an open source command-line tool that detects and removes unused classes, fields, methods, and attributes. It helps in creating a production-ready application in the Android Platform.


1 Answers

The first (-keep) will keep classes and class members that implement android.os.Parcelable from being removed or renamed.

The latter (-keepclassmembers) will keep class members only of classes that implement android.os.Parcelable from being removed or renamed.

like image 51
user1592811 Avatar answered Oct 01 '22 16:10

user1592811