[Bug]: Calling the permission crashes the app when showing the permission request dialog. Only present in android. No issue in IOS devices. #1623
Labels
status: needs more info
We need more information before we can continue work on this issue.
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
Deny permission to make the app ask for the permission.
Expected results
Needed to deny or accept the permission.
Actual results
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=109, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
E/AndroidRuntime( 9691): at android.app.ActivityThread.deliverResults(ActivityThread.java:4845)
E/AndroidRuntime( 9691): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
E/AndroidRuntime( 9691): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 9691): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 9691): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 9691): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
E/AndroidRuntime( 9691): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime( 9691): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 9691): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 9691): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9691): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 9691): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime( 9691): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
E/AndroidRuntime( 9691): at com.odehbros.flutter_file_downloader.permissions.PermissionHandler.onRequestPermissionsResult(PermissionHandler.java:87)
E/AndroidRuntime( 9691): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:746)
E/AndroidRuntime( 9691): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:405)
E/AndroidRuntime( 9691): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:912)
E/AndroidRuntime( 9691): at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:967)
E/AndroidRuntime( 9691): at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8264)
E/AndroidRuntime( 9691): at android.app.Activity.dispatchActivityResult(Activity.java:8114)
E/AndroidRuntime( 9691): at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
E/AndroidRuntime( 9691): ... 11 more
Code sample
Code sample
[Paste your code here]
Screenshots or video
Future determinePosition() async {
try {
bool serviceEnabled;
LocationPermission permission;
}
Version
geolocator: ^13.0.2
Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.2 24C101 darwin-arm64, locale en-NP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (5 available)
[✓] Network resources
• No issues found!
The text was updated successfully, but these errors were encountered: