Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNI error on AVIF - runtime crash on 4.13.1 #4761

Closed
tronku opened this issue Mar 10, 2022 · 10 comments · Fixed by AOMediaCodec/libavif#877
Closed

JNI error on AVIF - runtime crash on 4.13.1 #4761

tronku opened this issue Mar 10, 2022 · 10 comments · Fixed by AOMediaCodec/libavif#877

Comments

@tronku
Copy link

tronku commented Mar 10, 2022

Glide Version: 4.13.1

Integration libraries: Okhttp-4.9.0

Device/Android Version: Samsung M30s/10

Issue details / Repro steps / Use case background: App is crashing while using latest glide with AVIF integration.

Glide load line / GlideModule (if any) / list Adapter code (if any):

RequestBuilder<Bitmap> mainRequestBuilder = GlideApp.with(imageView)
                .asBitmap()
                .load(mainURL)
                .thumbnail(GlideApp.with(imageView).asBitmap().load(thumbUrl).apply(requestOptions))
                .apply(requestOptions)
                .listener(new MyImageLoadListener(listener));

Layout XML:

<FrameLayout xmlns:android="...

Stack trace / LogCat:

2022-03-10 16:01:37.132 23618-24007/com.application.zomato.internal A/zomato.interna: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.NoSuchFieldError: no "I" field "width" in class "Lorg/aomedia/avif/android/AvifDecoder$Info;" or its superclasses
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1115)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1069)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1007)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.lang.System.loadLibrary(java.lang.String) (System.java:1667)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void org.aomedia.avif.android.AvifDecoder.<clinit>() (AvifDecoder.java:1)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at boolean org.aomedia.avif.android.AvifDecoder.a(java.nio.ByteBuffer) (AvifDecoder.java:1)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at boolean xc.a.b(java.lang.Object, zc.d) (AvifByteBufferBitmapDecoder.java:2)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.h.b(com.bumptech.glide.load.data.e, int, int, zc.d, java.util.List) (DecodePath.java:4)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.h.a(com.bumptech.glide.load.data.e, int, int, zc.d, com.bumptech.glide.load.engine.h$a) (DecodePath.java:4)
2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.q.a(com.bumptech.glide.load.data.e, zc.d, int, int, com.bumptech.glide.load.engine.h$a) (LoadPath.java:6)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.DecodeJob.v(java.lang.Object, com.bumptech.glide.load.DataSource) (DecodeJob.java:15)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.DecodeJob.p(com.bumptech.glide.load.data.d, java.lang.Object, com.bumptech.glide.load.DataSource) (DecodeJob.java:4)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.DecodeJob.x() (DecodeJob.java:3)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.DecodeJob.l(zc.b, java.lang.Object, com.bumptech.glide.load.data.d, com.bumptech.glide.load.DataSource, zc.b) (DecodeJob.java:10)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.c.d(java.lang.Object) (DataCacheGenerator.java:1)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void dd.d$a.f(com.bumptech.glide.Priority, com.bumptech.glide.load.data.d$a) (ByteBufferFileLoader.java:2)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at boolean com.bumptech.glide.load.engine.c.b() (DataCacheGenerator.java:14)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.DecodeJob.E() (DecodeJob.java:6)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.DecodeJob.F() (DecodeJob.java:7)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void com.bumptech.glide.load.engine.DecodeJob.run() (DecodeJob.java:5)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void cd.a$c$a.run() (GlideExecutor.java:5)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void java.lang.Thread.run() (Thread.java:919)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]  at void cd.a$b$a.run() (GlideExecutor.java:2)
2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]
  • It's working fine for 4.13.0 though, probably an issue with proguard. We found that it's crashing for release builds not debug. We used the rules as mentioned on the readme.
@tronku tronku changed the title JNI error - runtime crash on 4.13.1 JNI error on AVIF - runtime crash on 4.13.1 Mar 13, 2022
@vigneshvg
Copy link
Contributor

probably an issue with proguard. We found that it's crashing for release builds not debug. We used the rules as mentioned on the readme.

Thanks for mentioning this. This could be the case. I will look into the proguard settings for JNI.

@vigneshvg
Copy link
Contributor

I am able to reproduce the issue with minifyEnabled set to true. Will fix soon. Tracking internally as b/224576412.

wantehchang pushed a commit to AOMediaCodec/libavif that referenced this issue Mar 14, 2022
Without this change, proguard will obfuscate members of the Info
class, which is being accessed by the native methods. The native
JNI code will crash as it will not be able to find the members with
their original names.

Fixes bumptech/glide#4761.
copybara-service bot pushed a commit that referenced this issue Mar 14, 2022
The update fixes proguard stripping/obfuscating of native code
and java members that are being accessed from native code.

Fixes Github issue #4761.

PiperOrigin-RevId: 434569408
copybara-service bot pushed a commit that referenced this issue Mar 14, 2022
The update fixes proguard stripping/obfuscating of native code
and java members that are being accessed from native code.

Fixes Github issue #4761.

PiperOrigin-RevId: 434569408
copybara-service bot pushed a commit that referenced this issue Mar 14, 2022
The update fixes proguard stripping/obfuscating of native code
and java members that are being accessed from native code.

Fixes Github issue #4761.

PiperOrigin-RevId: 434569408
copybara-service bot pushed a commit that referenced this issue Mar 14, 2022
The update fixes proguard stripping/obfuscating of native code
and java members that are being accessed from native code.

Fixes Github issue #4761.

PiperOrigin-RevId: 434574974
@vigneshvg
Copy link
Contributor

This issue is now fixed and should be available in the next glide release. In the meantime, if you would like to pick up the fix, you could depend directly on the updated version of libavif by including the following in your build.gradle as a temporary solution:

implementation 'org.aomedia.avif.android:avif:0.9.3.a319893'
implementation ("com.github.bumptech.glide:avif-integration:4.13.1") {
    exclude group: 'org.aomedia.avif.android', module: 'avif'
}

@tronku
Copy link
Author

tronku commented Mar 16, 2022

Directly adding the dependency is not working as somehow gradle is picking the older commit sha only... it worked after I added the proguard rules though

@tronku
Copy link
Author

tronku commented Mar 16, 2022

when can we expect this to be released?

@oluwabajio
Copy link

same issue i am facing also. Kindly make the release. Thanks.

@oluwabajio
Copy link

oluwabajio commented Apr 2, 2022

2022-03-10 16:01:37.132 23618-24007/com.application.zomato.internal A/zomato.interna: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.NoSuchFieldError: no "I" field "width" in class "Lorg/aomedia/avif/android/AvifDecoder$Info;" or its superclasses 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1115) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1069) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1007) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.lang.System.loadLibrary(java.lang.String) (System.java:1667) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void org.aomedia.avif.android.AvifDecoder.<clinit>() (AvifDecoder.java:1) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at boolean org.aomedia.avif.android.AvifDecoder.a(java.nio.ByteBuffer) (AvifDecoder.java:1) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at boolean xc.a.b(java.lang.Object, zc.d) (AvifByteBufferBitmapDecoder.java:2) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.h.b(com.bumptech.glide.load.data.e, int, int, zc.d, java.util.List) (DecodePath.java:4) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.h.a(com.bumptech.glide.load.data.e, int, int, zc.d, com.bumptech.glide.load.engine.h$a) (DecodePath.java:4) 2022-03-10 16:00:30.123 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.q.a(com.bumptech.glide.load.data.e, zc.d, int, int, com.bumptech.glide.load.engine.h$a) (LoadPath.java:6) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.DecodeJob.v(java.lang.Object, com.bumptech.glide.load.DataSource) (DecodeJob.java:15) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at com.bumptech.glide.load.engine.s com.bumptech.glide.load.engine.DecodeJob.p(com.bumptech.glide.load.data.d, java.lang.Object, com.bumptech.glide.load.DataSource) (DecodeJob.java:4) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.DecodeJob.x() (DecodeJob.java:3) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.DecodeJob.l(zc.b, java.lang.Object, com.bumptech.glide.load.data.d, com.bumptech.glide.load.DataSource, zc.b) (DecodeJob.java:10) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.c.d(java.lang.Object) (DataCacheGenerator.java:1) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void dd.d$a.f(com.bumptech.glide.Priority, com.bumptech.glide.load.data.d$a) (ByteBufferFileLoader.java:2) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at boolean com.bumptech.glide.load.engine.c.b() (DataCacheGenerator.java:14) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.DecodeJob.E() (DecodeJob.java:6) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.DecodeJob.F() (DecodeJob.java:7) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void com.bumptech.glide.load.engine.DecodeJob.run() (DecodeJob.java:5) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void cd.a$c$a.run() (GlideExecutor.java:5) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void java.lang.Thread.run() (Thread.java:919) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650] at void cd.a$b$a.run() (GlideExecutor.java:2) 2022-03-10 16:00:30.124 22346-23141/com.application.zomato.internal A/zomato.interna: runtime.cc:650]

@vigneshvg
Copy link
Contributor

@oluwabajio yeah it is the same issue that was fixed.

i will get back to you about the tagged release soon. thanks!

sjudd pushed a commit to sjudd/glide that referenced this issue May 4, 2022
The update fixes proguard stripping/obfuscating of native code
and java members that are being accessed from native code.

Fixes Github issue bumptech#4761.

PiperOrigin-RevId: 434574974
@vigneshvg
Copy link
Contributor

Tagged release 4.13.2 should fix AVIF related issues: https://github.com/bumptech/glide/releases/tag/v4.13.2

@tronku
Copy link
Author

tronku commented Oct 23, 2024

working fine now, closing

@tronku tronku closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants