zynkware / Document-Scanning-Android-SDK

Document Scanner is an Android library (kotlin based) for scanning documents based on CameraX API and a tiny version of OpenCV.
173 stars 65 forks source link

ANR caused while initing DocumentScanner #21

Open muhammadawaisshan opened 1 month ago

muhammadawaisshan commented 1 month ago
      DefaultDispatcher-worker-1 (native):tid=29 systid=3287 

00 pc 0x4c4ac libc.so (syscall + 28) (BuildId: 77338d8a2b4b56e6fd4f4505f9c828b6)

01 pc 0x232670 libart.so (art::ConditionVariable::WaitHoldingLocks + 140) (BuildId: 2452917c4ff69cbb6e75e5512260946b)

02 pc 0x573be4 libart.so (art::JNI::NewWeakGlobalRef + 876) (BuildId: 2452917c4ff69cbb6e75e5512260946b)

03 pc 0x519dbc libart.so (art::JavaVMExt::LoadNativeLibrary + 844) (BuildId: 2452917c4ff69cbb6e75e5512260946b)

04 pc 0x51c0 libopenjdkjvm.so (JVM_NativeLoad + 412) (BuildId: b1064b3de75b1f93daad0e68cd4667df)

05 pc 0x351230 libart.so (art_quick_generic_jni_trampoline + 144) (BuildId: 2452917c4ff69cbb6e75e5512260946b)

06 pc 0x211faf0 memfd:jit-zygote-cache (java.lang.Runtime.loadLibrary0 + 304)

07 pc 0x211f904 memfd:jit-zygote-cache (java.lang.Runtime.loadLibrary0 + 356)

08 pc 0x21308c4 memfd:jit-zygote-cache (java.lang.System.loadLibrary + 84)

   at java.lang.Runtime.nativeLoad(Native method)
   at java.lang.Runtime.nativeLoad(Runtime.java:1126)
   at java.lang.Runtime.loadLibrary0(Runtime.java:1080)
   at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
   at java.lang.System.loadLibrary(System.java:1661)
   at com.zynksoftware.documentscanner.ui.DocumentScanner$init$1.invokeSuspend(DocumentScanner.kt:42)
   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
   at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:111)
   at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:585)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
muhammadawaisshan commented 1 month ago

Used IO dispatcher too but anr remains same i.e:

val configuration = DocumentScanner.Configuration()
        configuration.imageQuality = 100
        configuration.imageSize = 1000000 // 1 MB
        configuration.imageType = Bitmap.CompressFormat.JPEG
        CoroutineScope(Dispatchers.IO).launch {
            DocumentScanner.init(this@App, configuration)
        }