shubham0204 / Android-Document-QA

A custom RAG pipeline for multi-document QA from PDF/DOCX documents, in Android
Apache License 2.0
52 stars 4 forks source link

Migrate from Hilt (Dagger2) to Koin for Dependency Injection #11

Closed shubham0204 closed 3 weeks ago

shubham0204 commented 4 weeks ago

Due to issues #4 originating from Hilt, the project is now being migrated to Koin. Koin is a light-weight DI framework written in Kotlin, and has been adopted by the developer community widely.

References

dcrowleyMunster commented 4 weeks ago

This code compiles however once run, the following error happens where the generated files are not in the expected directory structure?

Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.ml.shubham0204.docqa-DqcFSrNN4B3M38jFa8DzAA==/lib/x86/libhftokenizer.so"... at java.lang.Runtime.loadLibrary0(Runtime.java:1016) at java.lang.System.loadLibrary(System.java:1669) at com.ml.shubham0204.sentence_embeddings.HFTokenizer.(HFTokenizer.kt:51) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invokeSuspend(SentenceEmbedding.kt:24)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:8)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:4)  at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)  at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)  at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init(SentenceEmbedding.kt:23)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init$default(SentenceEmbedding.kt:18)  at com.ml.shubham0204.docqa.domain.embeddings.SentenceEmbeddingProvider$1.invokeSuspend(SentenceEmbeddingProvider.kt:18)  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)  at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)  at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) 

Longer error output

024-10-18 13:37:11.270 16523-16591 ubham0204.docq com.ml.shubham0204.docqa I at void kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run() (CoroutineScheduler.kt:684) 2024-10-18 13:37:11.270 16523-16591 ubham0204.docq com.ml.shubham0204.docqa I
2024-10-18 13:37:11.271 16523-16523 AndroidRuntime com.ml.shubham0204.docqa D Shutting down VM 2024-10-18 13:37:11.271 16523-16523 AndroidRuntime com.ml.shubham0204.docqa E FATAL EXCEPTION: main Process: com.ml.shubham0204.docqa, PID: 16523 java.lang.NoClassDefFoundError: com.ml.shubham0204.sentence_embeddings.HFTokenizer at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invokeSuspend(SentenceEmbedding.kt:24) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:8) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init(SentenceEmbedding.kt:23) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init$default(SentenceEmbedding.kt:18) at com.ml.shubham0204.docqa.domain.embeddings.SentenceEmbeddingProvider$1.invokeSuspend(SentenceEmbeddingProvider.kt:18) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.ml.shubham0204.docqa-DqcFSrNN4B3M38jFa8DzAA==/lib/x86/libhftokenizer.so"... at java.lang.Runtime.loadLibrary0(Runtime.java:1016) at java.lang.System.loadLibrary(System.java:1669) at com.ml.shubham0204.sentence_embeddings.HFTokenizer.(HFTokenizer.kt:51) at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invokeSuspend(SentenceEmbedding.kt:24)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:8)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding$init$2.invoke(Unknown Source:4)  at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)  at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)  at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init(SentenceEmbedding.kt:23)  at com.ml.shubham0204.sentence_embeddings.SentenceEmbedding.init$default(SentenceEmbedding.kt:18)  at com.ml.shubham0204.docqa.domain.embeddings.SentenceEmbeddingProvider$1.invokeSuspend(SentenceEmbeddingProvider.kt:18)  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)  at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)  at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)  2024-10-18 13:37:11.279 16523-16523 Process com.ml.shubham0204.docqa I Sending signal. PID: 16523 SIG: 9 2024-10-18 13:37:11.328 1996-2087 InputDispatcher system_server E channel 'b33a08e com.ml.shubham0204.docqa/com.ml.shubham0204.docqa.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

dcrowleyMunster commented 4 weeks ago

It might be that installing Oboe 1.4.3 might solve the issue of not finding the symbol in the error output

shubham0204 commented 4 weeks ago

This is a known issue https://github.com/shubham0204/Sentence-Embeddings-Android/issues/1 on the Sentence-Embeddings-Android repository. The library cannot be used in apps that run on x86-64 Android (emulators).

I suggest that you try running the app on an Android mobile device (ARM-based).

dcrowleyMunster commented 3 weeks ago

yep. the Docs-QA pops up when an android is connected. Well done and thanks