react-native-webrtc / react-native-webrtc/react-native-callkeep

android can't start app with exception NullPointerException

Open
#590 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
511
Avg merge
9h 12m
Merged PRs (30d)
2

Description

Bug report

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

When I'm trying to run app, I get crash after it's initialization. Then I've added log with options object in D/RNCK:RNCallKeepModule: setup, but there's null object. So in Android Studio I have log where FATAL_EXCEPTION happened on convertMapToJson method with options equals null, but on React Native side I have configured setup object explicitly

 const options: IOptions = {
      ios: {
        appName: strings.app_name,
      },
      android: {
        alertTitle: 'Permissions required',
        alertDescription: 'This application needs to access your phone accounts',
        cancelButton: 'Cancel',
        okButton: 'ok',
        imageName: 'phone_account_icon',
        additionalPermissions: [PermissionsAndroid.PERMISSIONS.CALL_PHONE],
        // Required to get audio in background when using Android 11
        foregroundService: {
          channelId: process.env.CHANNEL_ID,
          channelName: 'Foreground service for my app',
          notificationTitle: 'My app is running on background',
          notificationIcon: 'Path to the resource icon of the notification',
        },
      },
    }

    RNCallKeep.setup(options).then(r => {})

Steps to Reproduce

Run build on android with whatever buildVariant. Then I see crash after splash screen with log that I paste below

Versions

- Callkeep: "react-native-callkeep": "^4.3.3",
- React Native: "react-native": "0.64.0",
- Android: 11
- Phone model: Samsung SM-M325FV

Logs

This Is that log about I've said before with object options reference

D/RNCK:RNCallKeepModule: setup null
E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: PRIVATE PID: 22386
    java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.bridge.ReadableMapKeySetIterator com.facebook.react.bridge.ReadableMap.keySetIterator()' on a null object reference
        at io.wazo.callkeep.MapUtils.convertMapToJson(MapUtils.java:42)
        at io.wazo.callkeep.RNCallKeepModule.storeSettings(RNCallKeepModule.java:1033)
        at io.wazo.callkeep.RNCallKeepModule.registerPhoneAccount(RNCallKeepModule.java:271)
        at io.wazo.callkeep.RNCallKeepModule.setup(RNCallKeepModule.java:262)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:246)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:923)
E/ReactNativeJS: TypeError: Cannot read property 'init' of null, js engine: hermes
E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. 
          This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
V/FA: Recording user engagement, ms: 4066

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MapUtils.java:42 and trace the setup flow through RNCallKeepModule.setup, registerPhoneAccount, and storeSettings at RNCallKeepModule.java:1033. Reproduce with the listed React Native, CallKeep, Android 11, and Samsung versions, then verify that initialization no longer crashes when setup is called with the shown options object.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.