Is it possible to use ProGuard for only obfuscation. I don't want ProGuard to remove any classes from my projects. My intention to use ProGuard is only for obfuscation so as to prevent reverse engineering.
Asked
Active
Viewed 1.6k times
39
-
2Proguard does not prevent reverse engineering. – dcow Nov 21 '14 at 01:03
-
@dcow But it does make it harder, " The obfuscated code makes your APK difficult to reverse engineer" according to android developer docs – Johnathan Logan Aug 24 '17 at 01:15
-
@JohnathanLogan sure, but it doesn't fundamentally change the trust model. If the user has your client they can do anything your client can do. No amount of obfuscation is going to prevent that. Try running an Android app through jdgui or something similar. It's pretty easy to see what the app is doing even with proguard. You just don't get all the fancy enterprise java long names for classes--which usually just make things less readable anyway XD. If I actually wanted to protect some proprietary algorithm, I would not rely on proguard. There are better obfuscators, albeit more expensive. – dcow Aug 25 '17 at 00:00
1 Answers
41
Yes, by specifying
-dontshrink
-dontoptimize
You can find details on all configuration options in the ProGuard manual.
Note that shrinking and optimization may help preventing reverse engineering a bit.

Eric Lafortune
- 45,150
- 8
- 114
- 106
-
Thanks.I tried -dontoptimze before but it was still removing class files. When i tried both -dontshrink and -dontoptimize it works. – Vinoth Jul 11 '11 at 07:04
-
2Hello, Its 2015 and things have changed. The android world is moving to gradle, for one. Is this still supposed to work? With Gradle? – Vinay W May 21 '15 at 11:05
-
4
-
@Eric Lafortune How to Obfuscate code. I also want to only rename classes so that the decompiled code is unreadable. If I dont write anything in Proguard.pro then will it rename all the classes – Ankesh kumar Jaisansaria Apr 24 '16 at 15:08
-
Is this what I need to get it to run? # Add project specific ProGuard rules here. -dontshrink { *; } -dontoptimize { *; } – NukeouT Dec 31 '16 at 06:25
-
No it doesn't work, a quick experiment is to keep everything (**) in a jar. The output jar is still much smaller (about 3/4 in size) – tribbloid Jun 06 '17 at 18:49