huhx / compose_image_picker

📸 Image Picker for Jetpack Compose
MIT License
51 stars 4 forks source link

Crash on app demo #20

Open matteoKuama opened 1 year ago

matteoKuama commented 1 year ago

Hi I was looking for a package that had extactly the functionalities that yours offers but it keeps crashing even when i launch the demo app allowing all the permissions. Here the stack trace: FATAL EXCEPTION: main Process: com.huhx.app, PID: 17944 java.lang.NullPointerException: getString(indexDirectory) must not be null at com.huhx.picker.data.AssetLoader.load(AssetLoader.kt:105) at com.huhx.picker.data.AssetPickerRepository.getAssets(AssetPickerRepository.kt:11) at com.huhx.picker.data.AssetViewModel.initAssets(AssetViewModel.kt:44) at com.huhx.picker.data.AssetViewModel.access$initAssets(AssetViewModel.kt:14) at com.huhx.picker.data.AssetViewModel$initDirectories$1.invokeSuspend(AssetViewModel.kt:30) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1) at com.huhx.picker.data.AssetViewModel.initDirectories(AssetViewModel.kt:29) at com.huhx.picker.view.AssetPickerKt$AssetPicker$1.invokeSuspend(AssetPicker.kt:34) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:68) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:792) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@7c01437, Dispatchers.Main.immediate]

huhx commented 1 year ago

Thanks for your feedback, the issue maybe cause by demo refer to the old picker lib. I have already refer to the project code and upgrade the compose version and test it can work now. You can pull lasted code and try, hope it can help you.

frhnfrq commented 1 year ago

I pulled the latest code and tried, it didn't work. @huhx @matteoKuama have you found any fix?