Android: Proguard not obfuscating code, throwing errors

By : Jasper

Here is my configuration:


# Project target.
target=Google Inc.:Google APIs:22

proguard-project.txt: This is empty file i.e everything is commented in it.

The project normally compiles correctly, there are no errors.

When i try to export the apk i see many errors in console (and export fails):

    Proguard returned with error code 1. See console
    Warning: com.facebook.applinks.FacebookAppLinkResolver: can't find superclass or interface bolts.AppLinkResolver
    Warning: com.facebook.applinks.FacebookAppLinkResolver$1: can't find superclass or interface bolts.Continuation
    Warning: org.apache.commons.beanutils.BeanMap$2: can't find superclass or interface org.apache.commons.collections.Transformer
    Warning: org.apache.commons.beanutils.BeanMap$3: can't find superclass or interface org.apache.commons.collections.Transformer

But, if i comment out the proguard.config=... line in, i am able to export successfully without any errors - but the code is not obfuscated.

What am i doing wrong here?

By : Jasper


When you see warnings while exporting, make sure that all support libraries are available in build path. You can further suppress some warnings and get away with that - see below.

My support jars were getting obfuscated too (not sure if this is normal) resulting in app failing at runtime, so i had to explicitly prevent their obfuscation - see below.

target=Google Inc.:Google APIs:22

#To prevent a warning message:
-dontwarn org.ietf.jgss.**

#To prevent supporting jars from getting obfuscated you would need something like:
-keep class javax.** { *; }
-keep class org.** { *; }
-keep class android.** { *; }
By : Jasper

This video can help you solving your question :)
By: admin