Crashes in PermissionsModule.onRequestPermissionsResult

I’m developing using Pixel 3 with Android API 29. After permission requesting dialog dismissed(Accept or Decline), the app crashes.

Description

 Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference
    at com.facebook.react.modules.permissions.PermissionsModule.onRequestPermissionsResult(PermissionsModule.java:208)
    at com.facebook.react.ReactActivityDelegate$2.invoke(ReactActivityDelegate.java:171)
    at com.facebook.react.ReactActivityDelegate.onResume(ReactActivityDelegate.java:102)
    at com.facebook.react.ReactActivity.onResume(ReactActivity.java:57)
    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1453)
    at android.app.Activity.performResume(Activity.java:7962)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237) 
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
    at android.os.Handler.dispatchMessage(Handler.java:107) 
    at android.os.Looper.loop(Looper.java:214) 
    at android.app.ActivityThread.main(ActivityThread.java:7356) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

React Native version:

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 660.12 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 26, 28, 29
      Build Tools: 26.0.2, 28.0.3, 29.0.3
      System Images: android-21 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    react-native-create-library: 3.1.2
    react-native: 0.61.5

Snack, code example, screenshot, or link to a repository:

import {PermissionsAndroid} from 'react-native';

export default async function requestAllPermissions() {
  try {
    const granted = await PermissionsAndroid.requestMultiple(
      [PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.RECORD_AUDIO]
    );

    if (granted[PermissionsAndroid.PERMISSIONS.CAMERA] == PermissionsAndroid.RESULTS.GRANTED) {
      console.log('You can use the camera');
    } else {
      console.log('Camera permission denied');
    }
  } catch (err) {
    console.warn(err);
  }
}

1 possible answer(s) on “Crashes in PermissionsModule.onRequestPermissionsResult