Closed rajeshdeva232 closed 4 years ago
Can you send us the stacktrace of your crash or any other information about it?
I am also having the same issue my app got crash when checked Never ask again and deny the permission how to handle this
E/AndroidRuntime: FATAL EXCEPTION: main Process: app.com.contest, PID: 19358 java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=42, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {app.com.contest/com.karumi.dexter.DexterActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.finish()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4675) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4717) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1978) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:232) at android.app.ActivityThread.main(ActivityThread.java:7172) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.finish()' on a null object reference at com.karumi.dexter.DexterInstance.onPermissionsChecked(Unknown Source:27) at com.karumi.dexter.DexterInstance.updatePermissionsAsDenied(Unknown Source:34) at com.karumi.dexter.DexterInstance.onPermissionRequestDenied(Unknown Source:0) at com.karumi.dexter.Dexter.onPermissionsRequested(Unknown Source:9) at com.karumi.dexter.DexterActivity.onRequestPermissionsResult(Unknown Source:51) at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7814) at android.app.Activity.dispatchActivityResult(Activity.java:7664) at android.app.ActivityThread.deliverResults(ActivityThread.java:4668) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4717) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1978) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:232) at android.app.ActivityThread.main(ActivityThread.java:7172) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
Hi @rajeshdeva232 and @Akshay-73 could you please update your dexter version to the latest release available? This bug was fixed in PR #246 and released in version 6.0.1. If after updating the library you are still facing the NPE feel free to reopen this issue again.
Expected behavior
The application should not crash
Actual behavior
The application crash
Steps to reproduce
Dexter.withActivity(EditProfile.this) .withPermissions( Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE ).withListener(new MultiplePermissionsListener() { @Override public void onPermissionsChecked(MultiplePermissionsReport report) { if(report.areAllPermissionsGranted()){ showImageOption(); } if(report.isAnyPermissionPermanentlyDenied()){ showPermissionDialog(); } } @Override public void onPermissionRationaleShouldBeShown(List permissions, PermissionToken token) {
Version of the library
com.karumi:dexter:5.0.0