How do I keep a package in ProGuard?

How do I keep a package in ProGuard?

Keeping Entire Package Using Proguard

  1. Keeping names of public classes: -keep public class com.salmankhakwani.application.network.gson.models.*
  2. Keeping names of public classes for packages and sub-packages:
  3. Keeping names of public/protected/private classes/methods/fields for packages and sub-packages:

Is ProGuard worth?

I would recommend ProGuard. Even without obfuscation (which can significantly shorten the names used in the constant pool) it can remove “dead code” (unused methods) of used libraries, etc. (It can also be used to conveniently merge everything together). It takes a little bit of fiddling to “get correct”, esp.

Should I use R8 or ProGuard?

Proguard reduces the app size by 8.5% and compared to R8 which reduces the code by 10%. R8 has more Kotlin support compared to Proguard. R8 gives better outputs than Proguard, and to do so faster than Proguard does, thereby reducing overall build time.

Is ProGuard safe?

The answer is yes, R8 and ProGuard are the default application shrinker for Android provided by Android Studio that can secure your app against Reverse Engineering.

What is keep in proguard?

-keep disables all of ProGuard’s goodness. No shrinking, no obfuscation; not for classes, not for members. In real use cases, you can let ProGuard do at least some of it’s work. Even if your variables are accessed by reflection, you could remove and rename unused classes, for example.

Does proguard obfuscate package name?

How does ProGuard’s Name Obfuscation work. ProGuard uses dictionaries to define to what to rename a package, class or method. There is a default dictionary which just contains the letters a-z . class it would be renamed to b.

Do I need ProGuard?

It is quite easy to reverse engineer Android applications, so if you want to prevent this from happening, yes, you should use ProGuard for its main function: obfuscation. ProGuard has also two other important functions: shrinking which eliminates unused code and is obviously highly useful and also optimization.

Is ProGuard free?

Last Update: 2021-05-27. ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions.

How do I disable ProGuard?

Answer #1: Try to delete the proguard directory in your project. So proguard will forget its mapping.

Does ProGuard work with Kotlin?

In Android, the common tools are ProGuard and more recently, R8. This means that you can run ProGuard on your Kotlin app and everything should work as intended without crashing.

Is proguard free?

How do I disable proguard?

What happens if you don’t have a keep directive in ProGuard?

If you don’t specify a keep directive of any kind, then ProGuard is going to do it’s normal thing — it’s going to both shrink (i.e. remove unused code) and obfuscate (i.e. rename things) both classes and class members. See, this is why I said you should almost never use -keep. -keep disables all of ProGuard’s goodness.

What is ProGuard in Android?

What is ProGuard? 1 It reduces the size of the application. 2 It removes the unused classes and methods that contribute to the 64K method counts limit of an Android application. 3 It makes the application difficult to reverse engineer by obfuscating the code.

What is the difference between @keep and -keep in Android ProGuard?

@Keep support is actually implemented as a bunch of -keep rules in the default Android ProGuard rules file, so they’re essentially equivalent. Specifying -keep rules is more flexible as it offers wildcards, you can also use different variants which do slightly different things (-keepnames, -keepclasseswithmembers and more).

Does ProGuard remove onclick methods from my application?

My application has many activities and uses native library too. With the default ProGuard configuration which Eclipse generates ProGuard removes many things – OnClick methods, static members, callback methods which my native library uses… Is it there a simple way to instruct ProGuard to NOT remove anything from my package?

author

Back to Top