'Android 12 app crashes when users grants approximate location permission

When requesting location from the user, if approximate location is selected rather than exact location, the app crashes unexpectedly.

Logcat gives the error simply "permission is null".

In my manifest I am stating

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

and in my request I am simultaneously requesting both fine and course, as specified in googles guide here

const getPermission = await PermissionsAndroid.requestMultiple([
  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
  PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
]);

At this point, the app will crash, and only through logcat can I see the error

02-03 12:21:46.736 15320 15395 E AndroidRuntime: java.lang.IllegalArgumentException: permission is null


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source