Package Used : permission_handler: ^10.0.0

app/build.Gradle

compileSdkVersion 33
minSdkVersion 24
targetSdkVersion 33

android/build.gradle

kotlin_version = '1.7.10'

Permission added in AndroidManifest.xml

  <uses-permission
         android:name="android.permission.MANAGE_EXTERNAL_STORAGE"  tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.CAMERA" />

Crash log on click allow or denied permission


E/AndroidRuntime(13312): FATAL EXCEPTION: main
E/AndroidRuntime(13312): Process: com.app.example, PID: 13312
E/AndroidRuntime(13312): java.lang.AssertionError
E/AndroidRuntime(13312):    at io.flutter.plugins.firebase.messaging.FlutterFirebasePermissionManager.onRequestPermissionsResult(FlutterFirebasePermissionManager.java:33)
E/AndroidRuntime(13312):    at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:777)
E/AndroidRuntime(13312):    at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:409)
E/AndroidRuntime(13312):    at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:757)
E/AndroidRuntime(13312):    at io.flutter.embedding.android.FlutterFragment.onRequestPermissionsResult(FlutterFragment.java:915)
E/AndroidRuntime(13312):    at io.flutter.embedding.android.FlutterFragmentActivity.onRequestPermissionsResult(FlutterFragmentActivity.java:549)
E/AndroidRuntime(13312):    at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8833)
E/AndroidRuntime(13312):    at android.app.Activity.dispatchActivityResult(Activity.java:8663)
E/AndroidRuntime(13312):    at android.app.ActivityThread.deliverResults(ActivityThread.java:5857)
E/AndroidRuntime(13312):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:5903)
E/AndroidRuntime(13312):    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:54)
E/AndroidRuntime(13312):    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime(13312):    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(13312):    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(13312):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
E/AndroidRuntime(13312):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(13312):    at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(13312):    at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(13312):    at android.app.ActivityThread.main(ActivityThread.java:8663)
E/AndroidRuntime(13312):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13312):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/AndroidRuntime(13312):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
I/Process (13312): Sending signal. PID: 13312 SIG: 9

Permission request code

Future<PermissionStatus> requestStoragePermission() async {
  return Platform.isAndroid ? Permission.storage.request() : Permission.photos.request();
}


Solution 1: Sheetal Ghori

This issue was caused because of firebase_messaging: 13.0.0

Upgrading all packages related to firebase will resolve this crash issue on permission.

enter image description here


  firebase_core: ^1.22.0
  firebase_auth: ^3.8.0
  firebase_messaging: ^13.0.1
  firebase_dynamic_links: ^4.3.7

Issue closed in Github:

https://github.com/firebase/flutterfire/issues/9430 https://github.com/firebase/flutterfire/issues/9429


Solution 2: Kimman wky

https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions

I faced the same issue. I believe this is case where, READ_EXTERNAL_STORAGE is no longer a valid permission on Android 13. I tried to request permission for storage, and it crash like what you mentioned.

But, I believe our app need to support earlier version than Android 13. How should we handle properly for older version (need storage permission) together with newer Android 13 version (do not need/support storage permission).