guolindev / PermissionX

An open source Android library that makes handling runtime permissions extremely easy.
Apache License 2.0
3.54k stars 407 forks source link

线上崩溃问题,Firebase捕捉不到App内部的崩溃路径,只有sdk的崩溃信息 #285

Closed powerzd closed 3 months ago

powerzd commented 4 months ago

崩溃信息如下: Exception java.lang.IllegalStateException: at androidx.fragment.app.Fragment.requireContext (Fragment.java:972) at com.permissionx.guolindev.request.InvisibleFragment.onRequestNormalPermissionsResult (InvisibleFragment.kt:378) at com.permissionx.guolindev.request.InvisibleFragment.access$onRequestNormalPermissionsResult (InvisibleFragment.kt:40) at com.permissionx.guolindev.request.InvisibleFragment$requestNormalPermissionLauncher$1$1.invoke (InvisibleFragment.kt:60) at com.permissionx.guolindev.request.InvisibleFragment$requestNormalPermissionLauncher$1$1.invoke (InvisibleFragment.kt:59) at com.permissionx.guolindev.request.InvisibleFragment.postForResult$lambda$10 (InvisibleFragment.kt:713) at com.permissionx.guolindev.request.InvisibleFragment.$r8$lambda$6NDrwcmcbWj7a5Z4uhtH6n2rj_o at com.permissionx.guolindev.request.InvisibleFragment$$ExternalSyntheticLambda0.run (D8$$SyntheticClass) at android.os.Handler.handleCallback (Handler.java:958) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:230) at android.os.Looper.loop (Looper.java:319) at android.app.ActivityThread.main (ActivityThread.java:8918) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

powerzd commented 4 months ago

原因大致找到了: 我使用的是1.6.4版本,然后更新到了1.8.0,在init的时候,传进来的是一个弱饮用修饰的activity,发生崩溃的代码如下: // maybe user can turn some permissions on in settings that we didn't request, so check the denied permissions again for safety. for (permission in deniedPermissions) { if (PermissionX.isGranted(requireContext(), permission)) { pb.deniedPermissions.remove(permission) pb.grantedPermissions.add(permission) } } 1.6.4版本使用的是context,1.8.0使用的是requireContext,当activity被回收的时候,requireContext就崩了,从目前已知的信息分析到的

laibinzhi commented 3 months ago

同样

wujuan commented 3 months ago

相同问题, 希望开发者能处理,或者公告不再更新

guolindev commented 3 months ago

请尝试更新到1.8.1版本,已修复

dependencies {
    implementation 'com.guolindev.permissionx:permissionx:1.8.1'
}