koral-- / android-gif-drawable

Views and Drawable for displaying animated GIFs on Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android11 GifImageView Crashed

mozushixin opened this issue · comments

commented

[Native crash above happened with a Java pending exception as following] pl.droidsonroids.gif.GifIOException: GifError 103: Data is not in GIF format pl.droidsonroids.gif.GifInfoHandle.a(GifInfoHandle.java:5) pl.droidsonroids.gif.GifInfoHandle.void <init>(android.content.res.AssetFileDescriptor)(GifInfoHandle.java:5) pl.droidsonroids.gif.GifDrawable.void <init>(android.content.res.AssetFileDescriptor)(GifDrawable.java:5) pl.droidsonroids.gif.GifDrawable.void <init>(android.content.res.Resources,int)(GifDrawable.java:1) pl.droidsonroids.gif.GifViewUtils.boolean setResource(android.widget.ImageView,boolean,int)(GifViewUtils.java:10) pl.droidsonroids.gif.GifImageView.void setImageResource(int)(GifImageView.java:1)

commented

it's crashed when using ''(GifImageView)view.setImageResource(R.drawable.XXX)''

You need to do this :

GifDrawable gifFromResource = new GifDrawable( getResources(), R.drawable.XXX);
(GifImageView)view.setImageDrawable(gifFromResource)

Sorry for the delay?
@mozushixin Data is not in GIF format suggests that the drawable is not a gif.
Could you attach it here?

commented

@koral-- My data is a png resource. It need gif mustly now version?

commented

my device info:Pixel 3 Android 11,level 30
setting

Update:I update to 1.2.22,this bug is fix.Thank author.I keep this message for other users.

I'm in the same situation. In the old version, I identified whether a picture was a gif by creating a GifDrawable. If it was not equal to null and the numberOfFrames was greater than 1, it was considered as a gif.
Now I'm supporting Android 11. On some mobile phones (such as OPPO Reno5 Pro+), if a static picture is sent in, Native Crash will happen. It is normal if it is gif, and normal if it is other mobile phones. I created GifDrawable with gifdrawable (filedescriptor FD) , and of course, several similar constructors are the same.
The error message is:

A/libc: fdsan: attempted to close file descriptor 109, expected to be unowned, actually owned by FILE* 0x7b86e14018
A/libc: Fatal signal 6 (SIGABRT), code 0 (SI_USER) in tid 26166 (ceunity.arvideo), pid 26166 (ceunity.arvideo)
Process name is com.faceunity.arvideo, not key_process


Build fingerprint: 'OPPO/PDRM00/OP4EA7:11/RKQ1.200903.002/1616654491696:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2021-06-11 11:51:31+0800
pid: 26166, tid: 26166, name: ceunity.arvideo >>> com.faceunity.arvideo <<<
uid: 10397
signal 6 (SIGABRT), code 0 (SI_USER), fault addr --------
Abort message: 'fdsan: attempted to close file descriptor 109, expected to be unowned, actually owned by FILE* 0x7b86e14018'
x0 0000000000000000 x1 0000000000006636 x2 0000000000000006 x3 0000007fefc60c90
x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0000000000000020
x8 00000000000000f0 x9 7cc13294b8f72d11 x10 0000000000000001 x11 0000000000000000
x12 0000000000000018 x13 0000000060c2ddc2 x14 00063f9b827d7889 x15 000050015d2a2796
x16 0000007c0be2b7e0 x17 0000007c0be0ada0 x18 0000000000000001 x19 0000000000006636
x20 0000000000006636 x21 0000007c0d585000 x22 0000007c0e7e0b5c x23 0000000000000003
x24 0000007fefc60d80 x25 ffffff80ffffffc8 x26 0000007fefc60a00 x27 0000007fefc609c0
x28 0000007fefc60f10 x29 0000007fefc60d20
lr 0000007c0bdc28a4 sp 0000007fefc60940 pc 0000007c0bdc28c4 pst 0000000000001000
backtrace:
#00 pc 000000000007c8c4 /apex/com.android.runtime/lib64/bionic/libc.so (fdsan_error(char const*, ...)+484) (BuildId: 1ca28d785d6567d2b225cf978ef04de5)
#1 pc 000000000007c628 /apex/com.android.runtime/lib64/bionic/libc.so (android_fdsan_close_with_tag+740) (BuildId: 1ca28d785d6567d2b225cf978ef04de5)
#2 pc 000000000007cd28 /apex/com.android.runtime/lib64/bionic/libc.so (close+16) (BuildId: 1ca28d785d6567d2b225cf978ef04de5)
#3 pc 0000000000004e2c /data/app/~~dta9FcVaO-6MBMUQuHI-aQ==/com.faceunity.arvideo-YiwDHJmyBaXd4Jn09CFmRA==/lib/arm64/libpl_droidsonroids_gif.so (Java_pl_droidsonroids_gif_GifInfoHandle_openNativeFileDescriptor+200) (BuildId: 2379bca92985e1c4b4076ab79df68ab086bc689e)
#4 pc 000000000013ced4 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#5 pc 00000000001337e8 /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#6 pc 00000000001a8a94 /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#7 pc 0000000000318278 /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#8 pc 000000000030e5a4 /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+996) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#9 pc 000000000067ff34 /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+548) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#10 pc 000000000012d994 /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#11 pc 000000000024dab4 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~dta9FcVaO-6MBMUQuHI-aQ==/com.faceunity.arvideo-YiwDHJmyBaXd4Jn09CFmRA==/base.apk!classes3.dex] (pl.droidsonroids.gif.GifInfoHandle.openFileDescriptor+60)
#12 pc 00000000006801d8 /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+1224) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#13 pc 000000000012d994 /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#14 pc 000000000024dc50 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~dta9FcVaO-6MBMUQuHI-aQ==/com.faceunity.arvideo-YiwDHJmyBaXd4Jn09CFmRA==/base.apk!classes3.dex] (pl.droidsonroids.gif.GifInfoHandle.+24)
#15 pc 000000000067f8f8 /apex/com.android.art/lib64/libart.so (MterpInvokeDirect+1248) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#16 pc 000000000012d914 /apex/com.android.art/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#17 pc 000000000024dbbc [anon:dalvik-classes3.dex extracted in memory from /data/app/~~dta9FcVaO-6MBMUQuHI-aQ==/com.faceunity.arvideo-YiwDHJmyBaXd4Jn09CFmRA==/base.apk!classes3.dex] (pl.droidsonroids.gif.GifInfoHandle.openUri+64)
#18 pc 00000000006801d8 /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+1224) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#19 pc 000000000012d994 /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 91ea3336584f5c23cca0c4a4a9b7d164)
#20 pc 000000000024c440 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~dta9FcVaO-6MBMUQuHI-aQ==/com.faceunity.arvideo-YiwDHJmyBaXd4Jn09CFmRA==/base.apk!classes3.dex] (pl.droidsonroids.gif.GifDrawable.)

Sorry for the delay.
Regarding Data is not in GIF format error - GifDrawable supports only GIFs - so this error itself is expected if try to load a PNG.
So I'm closing this ticket.