Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running ProGuard having AQuery library

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!

like image 250
Reinherd Avatar asked Feb 13 '14 17:02

Reinherd


2 Answers

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)

like image 162
Eric Lafortune Avatar answered Oct 21 '22 08:10

Eric Lafortune


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.

like image 31
Devrim Avatar answered Oct 21 '22 08:10

Devrim