May I ask what's the proguard of animated-gif?
You can take a look at the Fresco ProGuard documentation. If you have ProGuard issues with animated-gif, please give us more details.
@oprisnik I copy the ProGuard text to my ProGuard file, but it's not working. It can't display gif in all devices.
Did you add the support version for animated GIFs to your projects according to Adding Fresco to your Project?
We made the core library smaller by making things like GIF support optional.
`compile 'com.facebook.fresco:fresco:0.10.0'
compile 'com.facebook.fresco:animated-gif:0.10.0'
compile 'com.facebook.fresco:imagepipeline-okhttp3:0.10.0'`
`# 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 *;
}
# Keep native methods
-keepclassmembers class * {
native <methods>;
}
-keep class com.facebook.animated.gif.** {
*;
}
-keep class com.facebook.** {
*;
}
-dontwarn okio.**
-dontwarn javax.annotation.**
# Keep native methods
-dontwarn com.android.volley.toolbox.**
# fresco end ------------------------`
Finally when I add below code, it's working.
`-keep class com.facebook.** {
*;
}`
Does it work if you add compile 'com.facebook.fresco:animated-base-support:0.10.0'?
A stack trace for the crash could also be helpful, thanks.
It doesn't crash and works well. It just didn't play gif when using proguard. My project's min sdk is 15.
My problem is that the proguard in ducumentation doesn't work well
Sounds like #1160 maybe?
+1
Animated gifs don't work when using ProGuard minification. In non minified debug builds they work properly. There is no crash, I just see a white screen (my background is white). But I know the gif is there, it's just invisible and doesn't play.
I'm on Nexus 4, 6.0.1 Android.
+1
gifs not loading with proguard, no error logs.
+1
+1
I've fixed this by adding this line to my proguard-rules:
-keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl {
public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier);
}
After comparing the GIF-related code before and after obfuscation, I found that the constructor method of AnimatedFactoryImpl is removed after obfuscation. This method may be invoked by reflection elsewhere I guess.
+1, @yingyixu your solution worked for me, thanks!
+1 @yingyixu thanks锛宨t is worked for me.
We've fixed this issue in 0d0c5757ff40eb9e9f23533c9798dcdde095ce86.
With the next release, you don't need to manually change your ProGuard files any more.
Thanks for reporting!
+1
Most helpful comment
I've fixed this by adding this line to my proguard-rules:
-keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl { public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier); }After comparing the GIF-related code before and after obfuscation, I found that the constructor method of AnimatedFactoryImpl is removed after obfuscation. This method may be invoked by reflection elsewhere I guess.