您的位置:首页 > 移动开发 > Android开发

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

2016-06-28 11:02 721 查看
针对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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  图片 android