react-native-callkeep
react-native-callkeep copied to clipboard
android can't start app with exception NullPointerException
Bug report
-
[x] I've checked the example to reproduce the issue.
-
Reproduced on:
-
[x] 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
Any solution for this error?