Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to check Proguard obfuscation has worked?

I have obfuscated my apk, but the file size has only been reduced from 12MB to 10.5MB.

The reason it is only a relatively small reduction may be because my app uses a couple of large libraries, but is there any way I can check the level of obfuscation that has been performed?

Just in case, this is my proguard-project.txt file...

# To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see #   http://developer.android.com/guide/developing/tools/proguard.html  # Add any project specific keep options here:  # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { #   public *; #}  -dontwarn twitter4j.** 

...and the libraries I'm using are android-support-v4.jar, acra-4.5.0.jar and twitter4j-core-4.0.2.jar.

like image 243
ban-geoengineering Avatar asked Dec 31 '14 01:12

ban-geoengineering


People also ask

How do you test ProGuard rules?

In Android Studio 4.1 you can do this by going to Build > Analyze APK and then selecting your APK that should have had Proguard run with it. You can then inspect the classes. dex file and check its contents. You can see which classes have been obfuscated and removed by directly traversing the file structure.

How does ProGuard obfuscation work?

Simply by enabling Proguard, we at Gradeup reduced our app size by a whooping 40%! It obfuscates the code, which means that it renames classes, fields, and methods with semantically obscure names that, in addition to making the codebase smaller and more efficient, also makes it difficult to reverse engineer the app.

Does ProGuard obfuscate code?

You can obfuscate Android code to provide security against reverse engineering. You can use the Android ProGuard tool to obfuscate, shrink, and optimize your code.


1 Answers

Here is probably a more visual way to check. In the newer release of Android Studio, it comes with the APK Analyser that let user explore what is in the APK file and it is handy to check if your class has been obfuscated.

Below image shows that both package and method name have been obfuscated

You can see the package name and method name is obfuscated

like image 172
WenChao Avatar answered Sep 21 '22 19:09

WenChao