Question

I have an Android app which uses Google Volley as my download broker. I just tried to use ProGuard to obfuscate the code, and find out the volley download starts failing at runtime.

Here's my ProGuard config:

-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keep class com.android.volley.** { *; }
-keep interface com.android.volley.** { *; }

-keepattributes *Annotation*

-dontwarn org.apache.**

and here is the error I saw in the code:

Async download FAILED. Exception message: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'a.a.a.b.c'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html.)

I was wondering if I did some proguard config caused some dependency problem. Please help out.

Était-ce utile?

La solution

The Apache logging library uses some reflection on its log factories. Keeping their names should be sufficient:

-keep class org.apache.commons.logging.**

Side-note on your configuration: -keep class ..... always implies -keep interface ....., so you can leave out the latter.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top