Fresco 0.10.0 混淆后 不能显示GIF图片(Proguard)

来源:互联网 发布:日本千叶大学知乎 编辑:程序博客网 时间:2024/06/08 04:27

针对fresco从0.9.0升级为0.10.0, 混淆后,GIF图片不能显示问题,提出以下解决方案步骤(升级后GIF不显示,是因为GIF图片显示库已被分离出来;混淆后不显示请看以下混淆代码,已经打包验证过):


1.app中build.gradle的dependencies中添加

compile "com.facebook.fresco:fresco:$FRESCO_VERSION"compile "com.facebook.fresco:animated-base-support:$FRESCO_VERSION"compile "com.facebook.fresco:animated-gif:$FRESCO_VERSION"

其中$FRESCO_VERSION变量在dependencies外定义,亦可直接用0.10.0+替换

def FRESCO_VERSION = '0.10.0+'

2.在混淆配置文件中添加

facebook fresco start -------------------------------------------------# Keep our interfaces so they can be used by other ProGuard rules.# See http://sourceforge.net/p/proguard/bugs/466/-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip# Do not strip any method/class that is annotated with @DoNotStrip-keep @com.facebook.common.internal.DoNotStrip class *-keepclassmembers class * {@com.facebook.common.internal.DoNotStrip *;}# can not display gif image.-keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl {    public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier);}-keep class com.facebook.animated.gif.** {*;}-dontwarn javax.annotation.**# facebook fresco end -------------------------------------------------

3.本例未使用okio网络框架做网络层

参考:https://github.com/facebook/fresco/issues/1177

2 0
原创粉丝点击