I am using the SocialSharing Mobile plugin to share a link on Android. When I copy a link from the menu, the app suddenly crashes, and an error message appears. This issue only occurs on Android.Error Message:
java.lang.RuntimeException: Unable to start receiver nl.xservices.plugins.ShareChooserPendingIntent: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
at android.app.ActivityThread.handleReceiver(ActivityThread.java:5212)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2708)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:249)
at android.os.Looper.loop(Looper.java:337)
at android.app.ActivityThread.main(ActivityThread.java:9631)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:615)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
at nl.xservices.plugins.ShareChooserPendingIntent.onReceive(ShareChooserPendingIntent.java:13)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:5203)
Hi @Tamilarasan Senthilkumar ,
Root Cause:
This is a known Android‑only issue in the SocialSharing Mobile plugin, and not an OutSystems logic problem.
The crash actually occurs inside the native Android broadcast receiver nl.xservices.plugins.ShareChooserPendingIntent.
When the user selects “Copy” from the Android share menu, the system does not populate Intent.EXTRA_CHOSEN_COMPONENT.
The plugin assumes this value is always present and calls .toString() on it, which results in a NullPointerException and crashes the app.
The crash happens after the share action returns, inside the native Cordova plugin, so:
will not prevent the crash.
Solution:
The issue has been fixed upstream in the Cordova SocialSharing plugin by adding proper null checks in the receiver. You need to upgrade the SocialSharing plugin.
Once you upgrade:
If upgrade is not possible, use workaround:
Avoid the system “Copy” option:
This bypasses the faulty Android broadcast receiver.
Hope this helps.
Cheers,
Saugat
Yes, this issue only exists on Android devices. In iOS, the web works fine. Therefore, I used the "NavigatorShare" plugin for Android.
Hi Tamil,
Can you try verifying behavior on different Android versions/devices to make sure you are getting the similar issue ?