QuickPermissions-Kotlin icon indicating copy to clipboard operation
QuickPermissions-Kotlin copied to clipboard

java.lang.IllegalStateException when using new Hilt lib

Open spectrumIG opened this issue 4 years ago • 3 comments

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 avatar Jun 16 '20 07:06 spectrumIG

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)

spectrumIG avatar Jun 16 '20 08:06 spectrumIG

I had the same problem. Any update on this?

anyercastillo avatar Jul 21 '20 05:07 anyercastillo

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

ashishrajvanshi01 avatar Aug 31 '22 16:08 ashishrajvanshi01