Question

I'm trying to configure Proguard, but I can't manage to get it working.

This is the error: enter image description here

I've tried things like:

-keep class com.android.auth.TwitterHandle.** { *; }
-keep class oauth.** { *; }

Without any luck.

Anyways, I don't really think ignoring is the answer. Because that might mean something is broken.

Any tips?

Thanks!

Was it helpful?

Solution

The warnings indicate that the AndroidQuery library depends on the OAuth library. Apparently, you're using the former library in your project, but the latter library is missing. You could add the missing library, but if your application is working fine without it in debug mode, you can just tell ProGuard to ignore the missing dependency. In this case:

-dontwarn com.androidquery.auth.**

or, to the same effect:

-dontwarn oauth.signpost.**

See the ProGuard manual > Troubleshooting > Warning: can't find referenced class

(I am the developer of ProGuard)

OTHER TIPS

Add these lines to your proguard file.

-dontwarn oauth.**
-dontwarn com.android.auth.TwitterHandle.**

-keep class oauth.** { *; }
-keep class com.android.auth.TwitterHandle.** { *; }

Edit:

Anyways, I don't really think ignoring is the answer. Because that might mean something is broken.

If you want to use Proguard and you are having some errors such as class not found, then you must disable/ignore their obfuscation. Because Proguard renames names, fields and methods of classes while obfuscating. This becomes a big problem if reflection is used for that classes. So you have to say proguard to ignore(not obfuscate) some classes to prevent this problem.

Please try this post https://stackoverflow.com/a/15477898/1665964

Insert to skip obfuscated in ProGuard your libs, jars, Classes and Subclasses with this example

-optimizationpasses 5
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-repackageclasses ''

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.MapActivity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider

-libraryjars  libs/commons-io-2.2.jar
-libraryjars  libs/gson-2.2.2.jar
-keep public class org.apache.commons.io.**
-keep public class com.google.gson.**
-keep public class com.google.gson.** {public private protected *;}

##---------------Begin: proguard configuration for Gson ----------
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.mypackage.ActivityMonitor.ClassMultiPoints.** { *; }
-keep public class com.mypackage.ActivityMonitor$ClassMultiPoints     { public protected *; }
-keep public class com.mypackage.ActivityMonitor$ClassMultiPoints$ClassPoints { public protected *; }
-keep public class com.mypackage.ActivityMonitor$ClassMultiPoints$ClassPoints$ClassPoint { public protected *; }
##---------------End: proguard configuration for Gson ----------

The reason for error must be that you might be using an external jar file (in libs folder).

If this is the case, adding the following line before -keep class ... lines should solve your problem.

-libraryjars libs/<jar_filename>

If u are unfamiliar with proguard cmd tool then you can try proguard gui located at tools/proguard/lib/proguardgui of your android SDK folder.

open proguardgui and load your configuration file.

then in Input / output section add your input and output jar as well as add your android lib used in your project. add your libs ***** your main problem is that you havent added your library (Aquery.jar and others) jar that is used in your project , so that proguard can't find the required Classes.***

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top