QuickPermissions / QuickPermissions-Kotlin

The most easiest way to handle Android Runtime Permissions in Kotlin
Apache License 2.0
317 stars 40 forks source link

java.lang.IllegalStateException when using new Hilt lib #20

Open spectrumIG opened 4 years ago

spectrumIG commented 4 years ago

After adding the new HIlt lib I had to remove this nice library because HIlt doesn't support support.Fragment but androidx Fragment only. I tracked the problem to be when checking the Context in the Permission Manager class of this lib. When arriving there the lib crash with the exception above and the message is that the Fragment is not attached. Thanks

spectrumIG commented 4 years ago

Here the stack trace: java.lang.IllegalStateException: Fragment PermissionCheckerFragment{d042f11} (650e49c7-72ff-4a41-a186-8764fd078153)} not attached to Activity at androidx.fragment.app.Fragment.requestPermissions(Fragment.java:1388) at com.livinglifetechway.quickpermissions_kotlin.util.PermissionCheckerFragment.requestPermissionsFromUser(PermissionCheckerFragment.kt:77) at com.livinglifetechway.quickpermissions_kotlin.PermissionsManagerKt.runWithPermissionsHandler(PermissionsManager.kt:146) at com.livinglifetechway.quickpermissions_kotlin.PermissionsManagerKt.runWithPermissions(PermissionsManager.kt:35) at it.vianova.meet.start.PermissionRequestFragment.checkPermission(PermissionRequestFragment.kt:106) at it.vianova.meet.start.PermissionRequestFragment$onViewCreated$1.onClick(PermissionRequestFragment.kt:53) at android.view.View.performClick(View.java:7870) at android.widget.TextView.performClick(TextView.java:14970) at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992) at android.view.View.performClickInternal(View.java:7839) at android.view.View.access$3600(View.java:886) at android.view.View$PerformClick.run(View.java:29363) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7814) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

anyercastillo commented 4 years ago

I had the same problem. Any update on this?

ashishrajvanshi01 commented 2 years ago

I am also facing same issue. Looks like this is still not fixed.