在ProGuard混淆之后,Volley似乎无法正常工作

时间:2014-02-16 21:08:34

标签: android obfuscation proguard

我有一个Android应用程序,它使用Google Volley作为我的下载代理。我只是试图使用ProGuard来混淆代码,并发现凌空下载开始在运行时失败。

这是我的ProGuard配置:

-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.**

这是我在代码中看到的错误:

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.)

我想知道我是否做了一些proguard配置导致了一些依赖性问题。请帮忙。

1 个答案:

答案 0 :(得分:8)

Apache日志记录库对其日志工厂使用了一些反射。保持他们的名字应该足够了:

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

关于您的配置的旁注:-keep class .....始终隐含-keep interface .....,因此您可以忽略后者。