Android ImageReader - Invalid format specified 42 - java

I have been working to capture images of the phone screen using ImageReader. The JPEG's I am receiving are not valid. With this setting:
ImageReader mImageReader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 10);
I get this in onImageAvailable:
W/AndroidMediaUtils: Image_getBlobSize: No JPEG/HEIC header detected, defaulting to size=width=2662272
2022-01-26 11:23:36.495 22708-22857/com.artistol.phonekast D/skia: --- Failed to create image decoder with message 'unimplemented'
If I try to extract a bitmap, the bitmap is null:
ByteBuffer myBuffer = image.getPlanes()[0].getBuffer();
myBuffer.rewind();
int mySize = myBuffer.remaining();
frame = new byte[mySize];
myBuffer.get(frame, 0, mySize);
final Bitmap bitmap = BitmapFactory.decodeByteArray(frame, 0, frame.length);
if (bitmap==null)
Log.d(TAG, "bitmap is null");
If I set things such that the height != width, I will see the following exception:
2022-01-26 11:30:29.251 23141-23194/com.name.subname A/AndroidMediaUtils: RGBA override BLOB format buffer should have height == width
2022-01-26 11:30:29.376 23141-23194/com.name.subname A/my_process: runtime.cc:655] Runtime aborting...
runtime.cc:655] Dumping all threads without mutator lock held
runtime.cc:655] All threads:
runtime.cc:655] DALVIK THREADS (27):
runtime.cc:655] "com.name.subname.MyService" prio=5 tid=23 Runnable
runtime.cc:655] | group="" sCount=0 dsCount=0 flags=0 obj=0x12e4cce8 self=0xb40000773250af00
runtime.cc:655] | sysTid=23194 nice=0 cgrp=default sched=0/0 handle=0x75b062bcc0
runtime.cc:655] | state=R schedstat=( 5329217 1502500 2 ) utm=0 stm=0 core=7 HZ=100
runtime.cc:655] | stack=0x75b0528000-0x75b052a000 stackSize=1043KB
runtime.cc:655] | held mutexes= "abort lock" "mutator lock"(shared held)
runtime.cc:655] native: #00 pc 000000000049ee3c /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
runtime.cc:655] native: #01 pc 00000000005abff8 /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+376)
runtime.cc:655] native: #02 pc 00000000005c9130 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+924)
runtime.cc:655] native: #03 pc 00000000005c3070 /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+528)
runtime.cc:655] native: #04 pc 00000000005c223c /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+1920)
runtime.cc:655] native: #05 pc 000000000055cec4 /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+1864)
runtime.cc:655] native: #06 pc 0000000000013978 /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
runtime.cc:655] native: #07 pc 0000000000006e18 /system/lib64/liblog.so (__android_log_assert+336)
runtime.cc:655] native: #08 pc 0000000000001644 /system/lib64/libmedia_jni_utils.so (android::getLockedImageInfo(android::CpuConsumer::LockedBuffer*, int, int, unsigned char**, unsigned int*, int*, int*)+1284)
runtime.cc:655] native: #09 pc 000000000003c66c /system/lib64/libmedia_jni.so (Image_createSurfacePlanes(_JNIEnv*, _jobject*, int, int)+616)
runtime.cc:655] at android.media.ImageReader$SurfaceImage.nativeCreatePlanes(Native method)
runtime.cc:655] - locked <0x004f434f> (a android.media.ImageReader$SurfaceImage)
runtime.cc:655] at android.media.ImageReader$SurfaceImage.getPlanes(ImageReader.java:912)
runtime.cc:655] at com.name.subname.MyService.processImage(MyService.java:341)
runtime.cc:655] at com.name.subname.MyService.access$600(MyService.java:60)
runtime.cc:655] at com.name.subname.MyService$2.onImageAvailable(MyService.java:293)
I have spent considerable time looking at this. I have experimented with changing my ImageReader setting to produce formats other than JPEG. Each time I get an exception such as the following when I use ImageFormat.FLEX_RGBA_8888 instead of ImageFormat.JPEG:
java.lang.UnsupportedOperationException: Invalid format specified 42
at android.media.ImageUtils.getNumPlanesForFormat(ImageUtils.java:73)
at android.media.ImageReader.<init>(ImageReader.java:274)
at android.media.ImageReader.newInstance(ImageReader.java:135)
I see that ImageFormat.FLEX_RGBA_8888 is defined as 0x29 (42) in ImageFormat.java. I reviewed ImageUtils.java code I found here:
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/media/java/android/media/ImageUtils.java;l=55;bpv=1;bpt=0
Indeed FLEX_RGBA_8888 is not one of the codes that getNumPlanesForFormat recognizes, so I can see why this is being rejected. I am an Android novice and could be missing the obvious, but why would ImageFormat provide values that are rejected by ImageReader? Put another way, if I enter some of the codes I see as valid in the ImageUtils case statement, such as PixelFormat.RGBA_8888, my code won't even compile. I'm told:
Must be one of: ImageFormat.UNKNOWN, ImageFormat.RGB_565, ImageFormat.YV12, ImageFormat.Y8, ImageFormat.NV16, ImageFormat.NV21, ImageFormat.YUY2, ImageFormat.JPEG, ImageFormat.DEPTH_JPEG, ImageFormat.YUV_420_888, ImageFormat.YUV_422_888, ImageFormat.YUV_444_888, ImageFormat.FLEX_RGB_888, ImageFormat.FLEX_RGBA_8888, ImageFormat.RAW_SENSOR, ImageFormat.RAW_PRIVATE, ImageFormat.RAW10, ImageFormat.RAW12, ImageFormat.DEPTH16, ImageFormat.DEPTH_POINT_CLOUD, ImageFormat.PRIVATE, ImageFormat.HEIC
Here is how I am setting things up:
ImageReader mImageReader = ImageReader.newInstance(width, height, ImageFormat.FLEX_RGBA_8888, 10);
mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
#Override
public void onImageAvailable(ImageReader reader) {
processImage(reader);
}
}, mImageReaderCallbackHandler);
MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
mMediaProjection = mediaProjectionManager.getMediaProjection(Activity.RESULT_OK, mIntent);
mMediaProjection.registerCallback(mMediaProjectionCallback, mMediaProjectionCallbackHandler);
mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture",
width, height, density,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mImageReader.getSurface(), mVirtualDisplayCallback, mVirtualDisplayCallbackHandler);
I am running this as a remote service and have been testing on a Samsung Note 8 and and Pixel 4a, both physical devices.
Edit 1:
In ImageReader's onImageAvailable, I have the following:
private void processImage(ImageReader reader){
byte[] frame;
Image image = reader.acquireLatestImage();
if(image!=null) {
ByteBuffer myBuffer = image.getPlanes()[0].getBuffer();
myBuffer.rewind();
int mySize = myBuffer.remaining();
frame = new byte[mySize];
myBuffer.get(frame, 0, mySize);
final Bitmap bitmap = BitmapFactory.decodeByteArray(frame, 0, frame.length);
if (bitmap==null)
Log.d(TAG, "bitmap is null");
image.close();
}
}

Related

Why apps only build on Android 11

I made an android app. The test was done with android version 9 and android version 11 devices.
But it works fine on android 11 version, but gives an error on android 9 version. I tried looking for information but couldn't find it. Thanks for your help.
Android 9 Error Code:
Build fingerprint: 'samsung/dreamlteks/dreamlteks:9/PPR1.180610.011/G950NKSU4DTD1:user/release-keys'
Revision: '11'
ABI: 'arm64'
pid: 14715, tid: 14715, name: mobile_20220531 >>> package_name <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
x0 0000000000000000 x1 000000000000000d x2 756f43656c69466e x3 6f6300203a20746e
x4 0000000000000028 x5 0000800000000000 x6 6e61ff1f391f736d x7 7f7f7f7f7f7f7f7f
x8 0000000000000000 x9 ffffffffffffffff x10 0000007d5b9d99d0 x11 ffffffffffffffff
x12 ffffffffffffffff x13 0000000000000001 x14 0000007dfb17d000 x15 ffffffffffffffff
x16 0000007d5b9a3910 x17 0000007d5b92b824 x18 0000000000000000 x19 0000007d74c14c00
x20 0000000000000000 x21 0000007d74c14c00 x22 0000007fc24b7340 x23 0000007d5e2f242d
x24 000000000000000c x25 0000007dfb6c35f8 x26 0000007d74c14ca0 x27 0000000000000003
x28 0000007fc24b7070 x29 0000007fc24b6b90
sp 0000007fc24b6b80 lr 0000007d5b92a6a4 pc 0000007d5b92b83c
Error Source:
ptr_entry_info = (st_entrymodel_info *)malloc(entry_cnt * sizeof(st_entrymodel_info))
More information
backtrace:
#00 pc 00000000000da114 /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk (offset 0x4929000) (_JNIEnv::NewByteArray(int)+24)
#01 pc 00000000000d8f78 /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk (offset 0x4929000) (MainControll::LogStrInt(char*, int, int, int, int, int)+160)
#02 pc 00000000000d8d30 /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk (offset 0x4929000) (Java_com_example_elfscoreprint_1mobile_120220531_MainActivity_GetFileData+640)
#03 pc 000000000056afe0 /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
#04 pc 0000000000561f88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#05 pc 00000000000d0140 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#06 pc 00000000002865e8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#07 pc 00000000002805a4 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
#08 pc 0000000000531240 /system/lib64/libart.so (MterpInvokeVirtual+584)
#09 pc 0000000000554614 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#10 pc 00000000000604f0 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (com.example.elfscoreprint_mobile_20220531.MainActivity.a+988)
#11 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#12 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#13 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#14 pc 0000000000532580 /system/lib64/libart.so (MterpInvokeDirect+296)
#15 pc 0000000000554714 /system/lib64/libart.so (ExecuteMterpImpl+14484)
#16 pc 00000000000600fc /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (com.example.elfscoreprint_mobile_20220531.MainActivity.b)
#17 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#18 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#19 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#20 pc 0000000000531240 /system/lib64/libart.so (MterpInvokeVirtual+584)
#21 pc 0000000000554614 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#22 pc 000000000005eefc /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (com.example.elfscoreprint_mobile_20220531.a.onMethodCall+4)
#23 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#24 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#25 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#26 pc 00000000005321b8 /system/lib64/libart.so (MterpInvokeInterface+1392)
#27 pc 0000000000554814 /system/lib64/libart.so (ExecuteMterpImpl+14740)
#28 pc 00000000000837c2 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage+34)
#29 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#30 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#31 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#32 pc 00000000005321b8 /system/lib64/libart.so (MterpInvokeInterface+1392)
#33 pc 0000000000554814 /system/lib64/libart.so (ExecuteMterpImpl+14740)
#34 pc 0000000000078760 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (io.flutter.embedding.engine.dart.DartMessenger.invokeHandler+36)
#35 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#36 pc 0000000000521980 /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
#37 pc 000000000056b0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#38 pc 00000000000144d8 /dev/ashmem/dalvik-jit-code-cache_32135_32135 (deleted) (io.flutter.embedding.engine.dart.DartMessenger.a+248)
#39 pc 0000000000561f88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#40 pc 00000000000d0140 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#41 pc 00000000002865e8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#42 pc 00000000002816b0 /system/lib64/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+752)
#43 pc 0000000000533db4 /system/lib64/libart.so (MterpInvokeDirectRange+244)
#44 pc 0000000000554a14 /system/lib64/libart.so (ExecuteMterpImpl+15252)
#45 pc 00000000000787c0 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (io.flutter.embedding.engine.dart.DartMessenger.b)
#46 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#47 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#48 pc 0000000000281694 /system/lib64/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+724)
#49 pc 0000000000532a78 /system/lib64/libart.so (MterpInvokeVirtualRange+576)
#50 pc 0000000000554914 /system/lib64/libart.so (ExecuteMterpImpl+14996)
#51 pc 000000000007787c /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.example.elfscoreprint_mobile_20220531-gO-SIf7DRkP95RhmXzloqg==/base.apk_32135_32135 (deleted) (io.flutter.embedding.engine.dart.c.run+24)
#52 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#53 pc 0000000000521980 /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
#54 pc 000000000056b0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#55 pc 00000000000146a0 /dev/ashmem/dalvik-jit-code-cache_32135_32135 (deleted) (android.os.Handler.handleCallback+64)
#56 pc 000000000056224c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
#57 pc 00000000000d0160 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
#58 pc 00000000002865e8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#59 pc 00000000002805a4 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
#60 pc 0000000000532744 /system/lib64/libart.so (MterpInvokeStatic+204)
#61 pc 0000000000554794 /system/lib64/libart.so (ExecuteMterpImpl+14612)
#62 pc 0000000000c4e7ac /system/framework/boot-framework.vdex (android.os.Handler.dispatchMessage+8)
#63 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#64 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#65 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#66 pc 0000000000531240 /system/lib64/libart.so (MterpInvokeVirtual+584)
#67 pc 0000000000554614 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#68 pc 0000000000c5741a /system/framework/boot-framework.vdex (android.os.Looper.loop+406)
#69 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#70 pc 000000000025fc20 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#71 pc 0000000000280588 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#72 pc 0000000000532744 /system/lib64/libart.so (MterpInvokeStatic+204)
#73 pc 0000000000554794 /system/lib64/libart.so (ExecuteMterpImpl+14612)
#74 pc 00000000004c1330 /system/framework/boot-framework.vdex (android.app.ActivityThread.main+220)
#75 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#76 pc 0000000000521980 /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
#77 pc 000000000056b0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#78 pc 000000000056224c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
#79 pc 00000000000d0160 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
#80 pc 00000000004682e0 /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#81 pc 0000000000469d38 /system/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1440)
#82 pc 00000000003f87b8 /system/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48)
#83 pc 000000000011f7e4 /system/framework/arm64/boot.oat (offset 0x115000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+180)
#84 pc 0000000000561f88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#85 pc 00000000000d0140 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#86 pc 00000000002865e8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#87 pc 00000000002805a4 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
#88 pc 0000000000531240 /system/lib64/libart.so (MterpInvokeVirtual+584)
#89 pc 0000000000554614 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#90 pc 00000000013bd79a /system/framework/boot-framework.vdex (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
#91 pc 000000000025a0a0 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2089273699+496)
#92 pc 0000000000521980 /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
#93 pc 000000000056b0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#94 pc 0000000000e16700 /system/framework/arm64/boot-framework.oat (offset 0x41f000) (com.android.internal.os.ZygoteInit.main+2208)
#95 pc 000000000056224c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
#96 pc 00000000000d0160 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
#97 pc 00000000004682e0 /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#98 pc 0000000000467f38 /system/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+416)
#99 pc 000000000036ab24 /system/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+644)
#100 pc 00000000000b9d10 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+120)
#101 pc 00000000000bc8d4 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+780)
#102 pc 0000000000004990 /system/bin/app_process64 (main+1200)
#103 pc 00000000000b0550 /system/lib64/libc.so (__libc_init+88)
Is there a problem because the version of the platform is 11.0.10 like in the image??

This Error Force close my app when I'm inspecting my table : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10

I have table in my application and I'm Running my app on Huawei y9 and this error pops up after a 30 sec and force close my application. I link my other question that I put the code of my table btw Im ussing implementation "androidx.room:room-runtime:2.3.0" and
annotationProcessor "androidx.room:room-compiler:2.3.0" but I don't think this casing the error.
my Error :
2022-03-05 20:41:45.893 29390-29425/com.example.myapplication A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10 in tid 29425 (HeapTaskDaemon), pid 29390 (e.myapplication)
2022-03-05 20:41:46.093 29837-29837/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-03-05 20:41:46.094 29837-29837/? A/DEBUG: Build fingerprint: 'HUAWEI/JKM-LX1/HWJKM-H:9/HUAWEIJKM-LX1/9.1.0.309C185:user/release-keys'
2022-03-05 20:41:46.094 29837-29837/? A/DEBUG: Revision: '0'
2022-03-05 20:41:46.094 29837-29837/? A/DEBUG: ABI: 'arm64'
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: Happend: 'Sat Mar 5 20:41:46 2022
'
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: SYSVMTYPE: Art
APPVMTYPE: Art
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: pid: 29390, tid: 29425, name: HeapTaskDaemon >>> com.example.myapplication <<<
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: Cause: null pointer dereference
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: x0 0000007cd5ef6f00 x1 0000007cb6eede48 x2 0000000000000008 x3 0000000000000400
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: x4 0000000017e08744 x5 0000000013489974 x6 0000000017e1fa50 x7 0000000017e1fa50
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: x8 0000000000000000 x9 fbafe48ae0791bf6 x10 0000000042c00000 x11 0000000000000008
2022-03-05 20:41:46.095 29837-29837/? A/DEBUG: x12 000000000000000b x13 17e053d000000000 x14 0000007cd5ec0d50 x15 00000cefaa754cdb
2022-03-05 20:41:46.096 29837-29837/? A/DEBUG: x16 0000007cd5b95ec0 x17 0000007d5909fdf0 x18 0000007cd5abea50 x19 0000007cb6eede48
2022-03-05 20:41:46.096 29837-29837/? A/DEBUG: x20 0000000070c0d868 x21 0000000000000008 x22 00000000714d2528 x23 00000000714d10b0
2022-03-05 20:41:46.096 29837-29837/? A/DEBUG: x24 0000000000000028 x25 00000000000023c8 x26 0000000000001478 x27 0000007cb6eef588
2022-03-05 20:41:46.096 29837-29837/? A/DEBUG: x28 00000000714d10c8 x29 0000007cb6eede30
2022-03-05 20:41:46.096 29837-29837/? A/DEBUG: sp 0000007cb6eeddc0 lr 0000007cd570e08c pc 0000007cd570e068
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: backtrace:
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #00 pc 00000000001d7068 /system/lib64/libart.so (_ZN3art6mirror6Object15VisitReferencesILb1ELNS_17VerifyObjectFlagsE0ELNS_17ReadBarrierOptionE1ENS_2gc9collector17ConcurrentCopying16RefFieldsVisitorES8_EEvRKT2_RKT3_+2504)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #01 pc 00000000001c9594 /system/lib64/libart.so (art::gc::collector::ConcurrentCopying::ImmuneSpaceScanObjVisitor::Callback(art::mirror::Object*, void*)+68)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #02 pc 00000000001bb220 /system/lib64/libart.so (art::gc::accounting::ModUnionTableReferenceCache::VisitObjects(void (*)(art::mirror::Object*, void*), void*)+224)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #03 pc 00000000001c6770 /system/lib64/libart.so (art::gc::collector::ConcurrentCopying::MarkingPhase()+244)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #04 pc 00000000001c51b8 /system/lib64/libart.so (art::gc::collector::ConcurrentCopying::RunPhases()+1176)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #05 pc 00000000001db930 /system/lib64/libart.so (art::gc::collector::GarbageCollector::Run(art::gc::GcCause, bool)+320)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #06 pc 0000000000201860 /system/lib64/libart.so (art::gc::Heap::CollectGarbageInternal(art::gc::collector::GcType, art::gc::GcCause, bool)+3404)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #07 pc 00000000001ff654 /system/lib64/libart.so (art::gc::Heap::DoPendingCollectorTransition()+108)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #08 pc 00000000002185c0 /system/lib64/libart.so (art::gc::Heap::CollectorTransitionTask::Run(art::Thread*)+40)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #09 pc 000000000023ab48 /system/lib64/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+68)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #10 pc 0000000000092a6c /system/framework/arm64/boot-core-libart.oat (offset 0x90000) (dalvik.system.VMRuntime.clampGrowthLimit [DEDUPED]+124)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #11 pc 0000000000580588 /system/lib64/libart.so (art_quick_invoke_stub+584)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #12 pc 00000000000d8608 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #13 pc 000000000028cec8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #14 pc 0000000000286ed0 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
2022-03-05 20:41:46.151 29837-29837/? A/DEBUG: #15 pc 0000000000547bf8 /system/lib64/libart.so (MterpInvokeVirtual+588)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #16 pc 0000000000572c94 /system/lib64/libart.so (ExecuteMterpImpl+14228)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #17 pc 00000000000bbe7e /system/framework/boot-core-libart.vdex (java.lang.Daemons$HeapTaskDaemon.runInternal+38)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #18 pc 0000000000260bd4 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4179671085+488)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #19 pc 00000000002666c8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #20 pc 0000000000286eb4 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #21 pc 0000000000547bf8 /system/lib64/libart.so (MterpInvokeVirtual+588)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #22 pc 0000000000572c94 /system/lib64/libart.so (ExecuteMterpImpl+14228)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #23 pc 00000000000bb9b4 /system/framework/boot-core-libart.vdex (java.lang.Daemons$Daemon.run+20)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #24 pc 0000000000260bd4 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4179671085+488)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #25 pc 00000000002666c8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #26 pc 0000000000286eb4 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #27 pc 00000000005489b4 /system/lib64/libart.so (MterpInvokeInterface+944)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #28 pc 0000000000572e94 /system/lib64/libart.so (ExecuteMterpImpl+14740)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #29 pc 00000000000cd1ce /system/framework/boot.vdex (java.lang.Thread.run+12)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #30 pc 0000000000260bd4 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.4179671085+488)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #31 pc 0000000000533b90 /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #32 pc 00000000005896fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #33 pc 0000000000580588 /system/lib64/libart.so (art_quick_invoke_stub+584)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #34 pc 00000000000d8608 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #35 pc 000000000047b3e8 /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #36 pc 000000000047c4a4 /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #37 pc 00000000004a8238 /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #38 pc 0000000000083a6c /system/lib64/libc.so (__pthread_start(void*)+36)
2022-03-05 20:41:46.152 29837-29837/? A/DEBUG: #39 pc 00000000000246e4 /system/lib64/libc.so (__start_thread+68)

JNI table overflow in android app

I have an android app that goes back and forth between a couple of screens organized as fragments of an activity that uses a viewPager to make scrolling possible.
When moving too much within these screens the app crashes with an
JNI ERROR (app bug): local reference table overflow (max=512)
here is the stacktrace:
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] JNI ERROR (app bug): local reference table overflow (max=512)
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] local reference table dump:
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] Last 10 entries (of 512):
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] 511: 0x144abc00 long[] (6 elements)
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] 510: 0x144abbc0 long[] (6 elements)
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] 509: 0x144abb80 long[] (6 elements)
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] 508: 0x144abb40 long[] (6 elements)
03-23 13:25:56.781 8120-8506/com.example.debug A/art: art/runtime/indirect_reference_table.cc:127] 507: 0x144abb00 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 506: 0x144abac0 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 505: 0x144aba80 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 504: 0x144aba40 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 503: 0x144aba00 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 502: 0x144ab9c0 long[] (6 elements)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] Summary:
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 511 of long[] (6 elements) (511 unique instances)
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127] 1 of java.lang.Thread
03-23 13:25:56.781 8120-8506/de.everskill.everskill.debug A/art: art/runtime/indirect_reference_table.cc:127]
03-23 13:25:56.781 3493-3573/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{5a171b1 u0 d0 Starting de.everskill.everskill.debug}
03-23 13:25:56.791 3035-3035/? D/libEGL: eglInitialize EGLDisplay = 0x7fff60dac8
03-23 13:25:56.791 1976-1976/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-23 13:25:56.791 1976-1976/? A/DEBUG: Build fingerprint: 'samsung/zerofltexx/zeroflte:6.0.1/MMB29K/G920FXXU5DQA7:user/release-keys'
03-23 13:25:56.791 1976-1976/? A/DEBUG: Revision: '11'
03-23 13:25:56.791 1976-1976/? A/DEBUG: ABI: 'arm64'
03-23 13:25:56.791 1976-1976/? A/DEBUG: pid: 8120, tid: 8699, name: pool-2-thread-1 >>> de.everskill.everskill.debug <<<
03-23 13:25:56.791 1976-1976/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
03-23 13:25:56.811 1976-1976/? A/DEBUG: Abort message: 'art/runtime/indirect_reference_table.cc:127] JNI ERROR (app bug): local reference table overflow (max=512)'
03-23 13:25:56.811 1976-1976/? A/DEBUG: x0 0000000000000000 x1 00000000000021fb x2 0000000000000006 x3 0000000000000000
03-23 13:25:56.811 1976-1976/? A/DEBUG: x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000000000000000
03-23 13:25:56.811 1976-1976/? A/DEBUG: x8 0000000000000083 x9 0000000000016240 x10 000000000057d960 x11 000000000057daa0
03-23 13:25:56.811 1976-1976/? A/DEBUG: x12 0000000000000000 x13 0000007f960f5000 x14 0000000000000000 x15 0000007f960e7000
03-23 13:25:56.811 1976-1976/? A/DEBUG: x16 0000007f960e7568 x17 0000007f9607a338 x18 0000000000000000 x19 0000007f59dff500
03-23 13:25:56.811 1976-1976/? A/DEBUG: x20 0000007f59dff440 x21 0000000000000011 x22 0000000000000006 x23 0000007f64056240
03-23 13:25:56.811 1976-1976/? A/DEBUG: x24 0000007f9236cbc0 x25 0000007f78ac5200 x26 0000007f92475bc0 x27 0000000000000001
03-23 13:25:56.811 1976-1976/? A/DEBUG: x28 0000007f64056100 x29 0000007f59dfe8b0 x30 0000007f96077ad4
03-23 13:25:56.811 1976-1976/? A/DEBUG: sp 0000007f59dfe8b0 pc 0000007f9607a340 pstate 0000000020000000
03-23 13:25:56.821 1976-1976/? A/DEBUG: backtrace:
03-23 13:25:56.821 1976-1976/? A/DEBUG: #00 pc 0000000000069340 /system/lib64/libc.so (tgkill+8)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #01 pc 0000000000066ad0 /system/lib64/libc.so (pthread_kill+68)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #02 pc 0000000000023910 /system/lib64/libc.so (raise+28)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #03 pc 000000000001e240 /system/lib64/libc.so (abort+60)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #04 pc 0000000000430e38 /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+304)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #05 pc 00000000001373a4 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #06 pc 0000000000272f88 /system/lib64/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+372)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #07 pc 000000000035bff0 /system/lib64/libart.so (_ZN3art3JNI21GetObjectArrayElementEP7_JNIEnvP13_jobjectArrayi+472)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #08 pc 0000000000156ee0 /system/lib64/libart.so (_ZN3art8CheckJNI21GetObjectArrayElementEP7_JNIEnvP13_jobjectArrayi+524)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #09 pc 0000000000052ef4 /data/app/de.everskill.everskill.debug-3/lib/arm64/librealm-jni.so (Java_io_realm_internal_TableQuery_nativeBatchUpdateQueries+616)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #10 pc 00000000018e6d40 /data/app/de.everskill.everskill.debug-3/oat/arm64/base.odex (offset 0xddf000) (long[] io.realm.internal.TableQuery.nativeBatchUpdateQueries(long, long[], long[][], long[][], boolean[][])+244)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #11 pc 0000000001903578 /data/app/de.everskill.everskill.debug-3/oat/arm64/base.odex (offset 0xddf000) (void io.realm.internal.async.QueryUpdateTask.run()+588)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #12 pc 0000000001900748 /data/app/de.everskill.everskill.debug-3/oat/arm64/base.odex (offset 0xddf000) (void io.realm.internal.async.BgPriorityRunnable.run()+140)
03-23 13:25:56.821 1976-1976/? A/DEBUG: #13 pc 0000000003492ec0 /system/framework/arm64/boot.oat (offset 0x2f48000)
What I got from googleing is that I am basically not cleaning up the memory I allocate and since I never leave the activity it is not done by the garbage collector automatically.
So I need to manullay release the allocated memory. But can you hint me towards anything on what to look for?
What kind of elements do allocate memory in this JNI Table?
And what is the JNI table?
How do I free memory in the table?
Thanks a lot guys!
Best
TobHo

Fatal Signal 11 (SIGSEGV) occurred in Android Studio program

An error occurs at times (more often than not, actually).
A/libc: Fatal signal 11 (SIGSEGV) at 0x830ab2cc (code=1), thread 24294 (Thread-1174)
The code is as follows:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.displaygraph);
Intent intent = getIntent();
GraphView graph = (GraphView) findViewById(R.id.graph);
series = new LineGraphSeries<DataPoint>();
graph.addSeries(series);
Viewport viewport = graph.getViewport();
viewport.setYAxisBoundsManual(true);
viewport.setXAxisBoundsManual(true);
viewport.setMinY(0);
double max=data[0];
for (int i = 0; i < data.length; i++) {
if (data[i] > max) {
max = data[i];
Log.w(TAG,"max"+max);
}
}
viewport.setMaxY(max);
viewport.setMinX(0);
viewport.setMaxX(450);
graph.getViewport().setScalable(true);
graph.getViewport().setScalableY(true);
seriesecg = new LineGraphSeries<DataPoint>();
GraphView graphecg = (GraphView) findViewById(R.id.graphecg);
graphecg.addSeries(seriesecg);
Viewport viewportecg = graphecg.getViewport();
viewportecg.setYAxisBoundsManual(true);
viewportecg.setXAxisBoundsManual(true);
viewportecg.setMinY(0);
viewportecg.setMaxY(3000);
viewportecg.setMinX(0);
viewportecg.setMaxX(450);
graphecg.getViewport().setScalable(true);
graphecg.getViewport().setScalableY(true);
}
#Override
protected void onResume() {
super.onResume();
new Thread(new Runnable() {
#Override
public void run() {
// we add 450 new entries
for (int i = 0; i <= 449; i++) {
final int finalI = i;
final int finalII = i;
Log.w(TAG, "finalI"+finalI);
runOnUiThread(new Runnable() {
#Override
public void run() {
addEntry(finalI,ppg);
}
});
// sleep to slow down the add of entries
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// manage error ...
}
}
}
}).start();
}
// add random data to graph
private void addEntry(int i,double[] data) {
if(i<=449) {
Log.w(TAG, "ppg" + data[i]+"/"+i);
series.appendData(new DataPoint(i, data[i]), false, 450);
}
}
The logcat is as follows:
01-22 19:27:01.650 1041-1370/? I/KeyguardUpdateMonitor: visibility is same
01-22 19:27:01.650 818-818/? D/CrashAnrDetector: Build: samsung/lt03ltezs/lt03lte:4.4.2/KOT49H/P605ZSUCOD1:user/release-keys
Hardware: MSM8974
Revision: 11
Bootloader: P605ZSUCOD1
Radio: unknown
Kernel: Linux version 3.4.0-4665213 (dpi#SWDD5621) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Mon Apr 13 11:19:19 KST 2015
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/lt03ltezs/lt03lte:4.4.2/KOT49H/P605ZSUCOD1:user/release-keys'
Revision: '11'
pid: 12476, tid: 12476, name: elerometergraph >>> com.android.accelerometergraph <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 82f5583c
r0 402aaedb r1 82f55838 r2 402aaed8 r3 42caa968
r4 bedfd1b8 r5 42277008 r6 bedfd20c r7 402aaaa8
r8 00000000 r9 42caad98 sl 416b049c fp 80000000
ip 00000003 sp bedfd010 lr 4172ff51 pc 4172ff3e cpsr 900f0030
d0 0080000000001000 d1 0200000000004000
d2 0000000000000008 d3 0000888800000000
d4 0000004080000000 d5 0000200000000000
d6 1000000000200000 d7 0000800000000010
d8 44618b1844624bf2 d9 3e99999a4040da00
d10 43380000c3892666 d11 c389266644618b18
d12 4252ccd044624bf2 d13 c07124cccccccccd
d14 4034000000000000 d15 43a38000c3892666
d16 0100000000000000 d17 0004400000020000
d18 0004400000000000 d19 2000010000440000
d20 000a402000088100 d21 0000000000044000
d22 0022000000008800 d23 1100000000000000
d24 3fd1b10853a79915 d25 3fd554fa9ca0567a
d26 3fdb6db71408e660 d27 3fe33333332d4313
d28 3ff0000000000000 d29 0000000000000001
d30 4059000000000000 d31 4024000000000000
scr 20000013
backtrace:
#00 pc 00075f3e /system/lib/libdvm.so (mspace_bulk_free+89)
#01 pc 00076e63 /system/lib/libdvm.so (dvmHeapSourceFreeList(unsigned int, void**)+70)
#02 pc 0003a7b4 /system/lib/libdvm.so
#03 pc 0002c4ec /system/lib/libdvm.so (dvmHeapBitmapSweepWalk(HeapBitmap const*, HeapBitmap const*, unsigned int, unsigned int, void (*)(unsigned int, void**, void*), void*)+176)
#04 pc 0003b53c /system/lib/libdvm.so (dvmHeapSweepUnmarkedObjects(bool, bool, unsigned int*, unsigned int*)+284)
#05 pc 0002c94c /system/lib/libdvm.so (dvmCollectGarbageInternal(GcSpec const*)+452)
#06 pc 0002d45c /system/lib/libdvm.so (dvmMalloc(unsigned int, int)+356)
#07 pc 0006cb03 /system/lib/libdvm.so
#08 pc 0002c36f /dev/ashmem/dalvik-jit-code-cache (deleted)
stack:
bedfcfd0 bedfd1ec [stack]
bedfcfd4 40129d5d /system/lib/libc.so (realloc+12)
bedfcfd8 00000008
bedfcfdc bedfd2a8 [stack]
bedfcfe0 78e476f8
bedfcfe4 00000000
bedfcfe8 00000003
bedfcfec bedfd100 [stack]
bedfcff0 42ca9b88 /dev/ashmem/dalvik-heap (deleted)
bedfcff4 bedfd174 [stack]
bedfcff8 42277008 /dev/ashmem/dalvik-heap (deleted)
bedfcffc bedfd20c [stack]
bedfd000 42caa968 /dev/ashmem/dalvik-heap (deleted)
bedfd004 00000000
bedfd008 42caa950 /dev/ashmem/dalvik-heap (deleted)
bedfd00c 4172ff51 /system/lib/libdvm.so (mspace_bulk_free+108)
#00 bedfd010 00029864
bedfd014 416b0438
bedfd018 00000065
bedfd01c 00000065
bedfd020 bedfd078 [stack]
bedfd024 416b0438
bedfd028 42277008 /dev/ashmem/dalvik-heap (deleted)
bedfd02c 41730e67 /system/lib/libdvm.so (dvmHeapSourceFreeList(unsigned int, void**)+74)
#01 bedfd030 00000065
bedfd034 402abf98 /system/lib/libandroidfw.so
bedfd038 bedfd2cc [stack]
bedfd03c bedfd2cc [stack]
bedfd040 00000065
bedfd044 61fff040 /dev/ashmem/dalvik-bitmap-2 (deleted)
bedfd048 617ff040 /dev/ashmem/dalvik-bitmap-1 (deleted)
bedfd04c 0001acbf
bedfd050 bedfd078 [stack]
bedfd054 416f47b8 /system/lib/libdvm.so
#02 bedfd058 00000000
bedfd05c 00000000
bedfd060 00000030
bedfd064 00015010
bedfd068 01501
01-22 19:27:01.650 818-818/? D/CrashAnrDetector: processName:com.android.accelerometergraph
01-22 19:27:01.650 818-818/? D/CrashAnrDetector: broadcastEvent : com.android.accelerometergraph SYSTEM_TOMBSTONE
01-22 19:27:01.660 1041-1055/? D/KeyguardUpdateMonitor: sendKeyguardVisibilityChanged(true)
01-22 19:27:01.660 1041-1055/? I/KeyguardUpdateMonitor: visibility is same
Sometimes the code works but sometimes it doesn't... but when it occurs, it does so before the value of i reaches 449. I thought it had something to do with my jni code. but after commenting and deleting everything that would call a c code, the error still occurred.
Thank you for your help...

Thread Join appears to be deadlocking

Could somebody shed some light on this error being reported:
"main" prio=5 tid=1 WAIT
| group="main" sCount=1 dsCount=0 obj=0x40b97568 self=0x40b5ba68
| sysTid=29071 nice=0 sched=0/0 cgrp=apps handle=1074202160
| schedstat=( 2218977000 625819000 2260 ) utm=177 stm=44 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x412f4160> (a java.lang.VMThread) held by tid=12 (Thread-699)
at java.lang.Object.wait(Object.java:364)
at java.lang.Thread.join(Thread.java:761)
at com.pyesmeadow.pendulumclock.PendulumAppView.pause(PendulumAppView.java:419)
It seems to indicate that it's waiting on a thread with an id of 12. Looking at the stack traces, I have the following for thread #12:
"Thread-699" prio=5 tid=12 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41715d38 self=0x678ba008
| sysTid=29098 nice=0 sched=0/0 cgrp=apps handle=1642643840
| schedstat=( 12528326000 501640000 3154 ) utm=1206 stm=46 core=0
#00 pc 0000dc70 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0001212c /system/lib/libc.so
#02 pc 0001a9cf /system/lib/libgui.so
#03 pc 00021351 /system/lib/libgui.so (android::SurfaceTextureClient::disconnect(int)+32)
#04 pc 000213c7 /system/lib/libgui.so (android::SurfaceTextureClient::~SurfaceTextureClient()+22)
#05 pc 00021445 /system/lib/libgui.so (android::SurfaceTextureClient::~SurfaceTextureClient()+4)
#06 pc 0000ee89 /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+40)
#07 pc 000497db /system/lib/libandroid_runtime.so (android::sp<android::InputChannel>::~sp()+10)
#08 pc 000567e1 /system/lib/libandroid_runtime.so
#09 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
#10 pc 0004d083 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
#11 pc 00027260 /system/lib/libdvm.so
#12 pc 0002bb68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#13 pc 0005f7f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
#14 pc 0005f81b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#15 pc 000543d3 /system/lib/libdvm.so
#16 pc 00012dd0 /system/lib/libc.so (__thread_entry+48)
#17 pc 00012528 /system/lib/libc.so (pthread_create+172)
at android.view.Surface.isValid(Native Method)
at com.pyesmeadow.pendulumclock.PendulumAppView$WorkerThread.run(PendulumAppView.java:169)
Basically, that thread is responsible for updating the UI. The line of code it is referring to is a call to isValid():
if( _surfaceHolder.getSurface().isValid() )
{
// ...
}
Going back to the first stack dump (above), it seems that the problem is occurring in the call to _workerThread.join() (_workerThread is the thread with an id of #12) in this code:
public void pause()
{
_workerThread.setRunning( false );
// Wait for the background thread to terminate.
while( true )
{
try
{
_workerThread.join();
break;
}
catch( InterruptedException ex )
{
}
}
}
It seems that by calling join() on the worker thread a deadlock is occurring but I don't know why.
Any help would be appreciated.
Wayne.
****** UPDATE **********
Here is the code for my run() method inside the worker thread:
(note that in the production version of my code _running\ is a non-volatile boolean)
public void setRunning( boolean flag )
{
_running = flag;
}
#Override
public void run()
{
int previousIndex = 0;
_timeSwingStarted = new Date();
while( _running )
{
if( _swingPath == null || _swingPath.isEmpty() )
continue;
if( Thread.interrupted() )
break;
if( _mode == PendulumMode.Swinging )
{
Date current = new Date();
long elapsed = current.getTime() - _timeSwingStarted.getTime();
int index = (int) Math.floor( ((double) Math.min(elapsed, 2000.0f) / 2000.0f) * (_swingPath.size() - 1) );
index = Math.max( Math.min( index, _swingPath.size() - 1), 0 );
if( index == previousIndex )
continue;
// Calculate the position of the pendulum and render it on the display
_currentPosition = _swingPath.get( index );
// only render the UI if there is a valid surface to render on
if( _surfaceHolder.getSurface().isValid() )
_theme.render( _currentPosition, _scrollOffsetY, _showFPS );
// Check whether the direction of the pendulum has changed
previousIndex = index;
if( index >= _swingPath.size() - 1 )
_timeSwingStarted = new Date();
}
//
// Check whether we should close the app automatically if a
// specified battery level has been reached.
//
if( _closeWhenBatteryLow && isBatteryLevelBelowThreshold() )
{
//
// Schedule a shutdown time and notify the user in case they wish
// to change their minds by adjusting the app settings.
//
if( _shutDownTime == null )
{
_shuttingDownReason = ShutdownReason.BatteryLow;
_shutDownTime = Calendar.getInstance();
_shutDownTime.add( Calendar.MINUTE, 2 );
((Activity) _context).runOnUiThread( new Runnable() {
public void run() {
showWarning( getResources().getString( R.string.batteryLowClosingMessage ) );
}
});
}
}
//
// Determine whether it's time to shutdown the app, if so the perform
// some extra checks to ensure that the user hasn't changed their minds
// since the initial message was displayed.
//
if( _shutDownTime != null )
{
Calendar now = Calendar.getInstance();
if( now.after( _shutDownTime ) )
{
if( _shuttingDownReason == ShutdownReason.BatteryLow )
{
if( _closeWhenBatteryLow && isBatteryLevelBelowThreshold() )
{
((Activity) _context).finish();
}
else
{
_shuttingDownReason = ShutdownReason.None;
_shutDownTime = null;
}
}
}
}
try
{
Thread.sleep( _sleepDuration );
}
catch( InterruptedException e )
{
/* at least we tried */
}
}
}
This line seems to indicate a problem:
_workerThread.setRunning( false );
Are you polling a boolean flag somewhere to see if you need to stop? It should be declared volatile in that case.
Try:
while( true ){
_workerThread.interrupt();
try
{
_workerThread.join();
break;
}
catch( InterruptedException ex )
{
}
}
With mine thread it works fine like that..
EDIT:
Tudor has your solution in the comments of my post.

Categories