Fresco: Load gif lib error

Created on 28 Apr 2015  ·  15Comments  ·  Source: facebook/fresco

I build fresco 4.0 like this: compile 'com.facebook.fresco:fresco:0.4.0+'

When I load a gif image into fresco image view, the app crash, the error info like:

E/AndroidRuntime( 5755): java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.wandoujia.ripple-2/lib/arm/libgifimage.so"
E/AndroidRuntime( 5755): at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/AndroidRuntime( 5755): at java.lang.System.loadLibrary(System.java:988)
E/AndroidRuntime( 5755): at com.facebook.common.soloader.SoLoaderShim$DefaultHandler.loadLibrary(SoLoaderShim.java:34)
E/AndroidRuntime( 5755): at com.facebook.common.soloader.SoLoaderShim.loadLibrary(SoLoaderShim.java:56)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.gif.GifImage.ensure(GifImage.java:40)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.gif.GifImage.create(GifImage.java:62)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.animated.factory.AnimatedImageFactory.decodeGif(AnimatedImageFactory.java:62)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.decoder.ImageDecoder.decodeAnimatedGif(ImageDecoder.java:105)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.decoder.ImageDecoder.decodeImage(ImageDecoder.java:86)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:231)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:92)
E/AndroidRuntime( 5755): at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$3.run(DecodeProducer.java:202)
E/AndroidRuntime( 5755): at com.facebook.common.executors.SerialDelegatingExecutor.executeSingleCommand(SerialDelegatingExecutor.java:76)
E/AndroidRuntime( 5755): at com.facebook.common.executors.SerialDelegatingExecutor.access$000(SerialDelegatingExecutor.java:24)
E/AndroidRuntime( 5755): at com.facebook.common.executors.SerialDelegatingExecutor$1.run(SerialDelegatingExecutor.java:47)
E/AndroidRuntime( 5755): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 5755): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 5755): at java.lang.Thread.run(Thread.java:818)

The device is nexus6.

bug

Most helpful comment

多谢,帮我解决了问题(不知道打中文能不能看懂,逗逗歪果仁,哈哈~)

All 15 comments

Happen on Nexus 5 running on Android 5.1 + Fresco 0.2.0, 0.3.0 or 0.4.0 too.

Does this happen without proguard as well ?

@michalgr let me try without proguard and update here.

@michalgr @rockerhieu it works~

-keep class com.facebook.imagepipeline.gif.** { _; }
-keep class com.facebook.imagepipeline.webp._* { *; }

@michalgr it works with proguard disabled. Do you have any suggestion on fixing the proguard rules? In the mean time I will try with different rules and see if I can get rid of the issue.

@duguguiyu cool, didn't refresh the page :smile_cat:

@duguguiyu your config looks good to me :)
We'll put something about configuring proguard in the docs.

Here is my final proguard file:

# 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 *;
}
-dontwarn okio.**
-dontwarn javax.annotation.**

-keep class com.facebook.imagepipeline.gif.** { *; }
-keep class com.facebook.imagepipeline.webp.** { *; }

多谢,帮我解决了问题(不知道打中文能不能看懂,逗逗歪果仁,哈哈~)

It seems some developers need to learn Chinese.also, foreigners are not wai nuts . lol

SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.imageview);
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithResourceId(R.raw.sample_gif).build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(imageRequest.getSourceUri())
.setAutoPlayAnimations(true)
.build();
simpleDraweeView.setController(controller);

Thanks for helping me solve the problem.

For the latest version, proguard should be:

-keep class com.facebook.animated.webp.** { *; }
-keep class com.facebook.animated.gif.** { *; }

You solve my problem, thank you so much

Was this page helpful?
0 / 5 - 0 ratings