Cordova-plugin-x-socialsharing-android12 throw a Fatal Exception when you try to share by WhatsApp on Android 13

Hi there, I’m using cordova-plugin-x-socialsharing to share data by WhatsApp, on Android12 it works perfectly but on Android13 it crashes and closes the app, debugging the apk with Android Studio I could rescue this error message:

2023-02-27 11:18:23.413 11744-11744/ E/AndroidRuntime: FATAL EXCEPTION: main
    Process:, PID: 11744
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.whatsapp/}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
        at androidx.activity.ComponentActivity.startActivityForResult(
        at org.apache.cordova.CordovaActivity.startActivityForResult(
        at androidx.activity.ComponentActivity.startActivityForResult(
        at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(
        at nl.xservices.plugins.SocialSharing$2$
        at android.os.Handler.handleCallback(
        at android.os.Handler.dispatchMessage(
        at android.os.Looper.loopOnce(
        at android.os.Looper.loop(
        at java.lang.reflect.Method.invoke(Native Method)

My plugin invocation from a vue js based app (this works even on Android12):

            'some message...',
            ok => {
            err => {

if I intent to use the shareWhitOptions method like this (it also works even on Android12):

let options = {
            subject:  'Text',
            url: null,
            message:  'Text',
            chooserTitle: 'Text',
            ok => {
            err => {

It doesn’t show the apps to share like WhatsApp or Google Messages, it just show the basic sharing options: Bluetooth, Gmail, Drive, Messages(SMS).

My config.xml data is this:

<?xml version='1.0' encoding='utf-8'?>
<widget id="" version="1.0.0" xmlns="" xmlns:android="" xmlns:cdv="">
    <name>Company Name</name>
        Company Name
    <author email="" href="">
        Company Name
    <access origin="*" />
    <access origin="content:///*" />
    <allow-navigation href="https://backendUrl/*" />
    <allow-navigation href="http://*/*" />
    <allow-navigation href="https://*/*" />
    <allow-navigation href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="maps:*" />
    <allow-intent href="appcustomurl:" />
    <content src="index.html" />
    <engine name="android" spec="11.0.0" />
    <preference name="AndroidLaunchMode" value="singleInstance" />
    <preference name="phonegap-version" value="cli-9.0.0" />
    <preference name="fullscreen" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="SplashMaintainAspectRatio" value="false" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="android-minSdkVersion" value="26" />
    <preference name="android-targetSdkVersion" value="33" />
    <preference name="Hostname" value="ss-app" />
    <preference name="Scheme" value="https" />
    <preference name="iosScheme" value="https" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="BackupWebStorage" value="local" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="Suppresses3DTouchGesture" value="true" />
    <preference name="Allow3DTouchLinkPreview" value="false" />
    <preference name="WKWebViewOnly" value="true" />
    <preference name="AllowInlineMediaPlayback" value="true" />
    <preference name="SplashScreenDelay" value="2000" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="AndroidWindowSplashScreenBackground" value="#ffffff" />
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/splashTemplate.png" />
    <platform name="android">
        <allow-intent href="market:*" />
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:usesCleartextTraffic="true" />
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
            <application android:exported="true" />
        <config-file parent="/manifest/application/activity" target="AndroidManifest.xml">
                <action android:name="" />
                <category android:name="android.intent.category.DEFAULT" />
        <config-file parent="/manifest" target="AndroidManifest.xml">
                <package android:name="com.whatsapp" />
                <package android:name="com.whatsapp.w4b" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <preference name="loadUrlTimeoutValue" value="12000000" />
        <preference name="SplashMaintainAspectRatio" value="true" />
        <preference name="SplashShowOnlyFirstTime" value="true" />
        <preference name="AndroidXEnabled" value="true" />
        <resource-file src="FCM/google-services.json" target="app/google-services.json" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.3" />
    <plugin name="cordova-plugin-dialogs" spec="^2.0.2" />
    <plugin name="cordova-plugin-camera" />
    <plugin name="cordova-plugin-device" spec="^2.0.3" />
    <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
    <plugin name="cordova-plugin-inappbrowser" spec="^4.0.0" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.3" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="2.1.3" />
    <plugin name="cordova-plugin-geolocation" spec="^4.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^4.1.2" />
    <plugin name="@havesource/cordova-plugin-push@dev" /><!-- use @dev flag if it fails on android 12 when the device recieves a notif-->
    <plugin name="cordova-plugin-x-socialsharing-android12" />
    <plugin name="cordova-plugin-androidx-adapter" />
    <plugin name="cordova-plugin-customurlscheme">
        <variable name="URL_SCHEME" value="appcustomurl" />
    <feature name="Custom URL scheme">         
        <param name="id" value="cordova-plugin-customurlscheme" />
        <param name="url" value="" />
        <variable name="URL_SCHEME" value="appcustomurl" />
    <feature name="SocialSharing">
        <param name="android-package" value="nl.xservices.plugins.SocialSharing" />

And when I try to use the Cordova engine “11.1.0” I get this error:

UserError: npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-android@11.1.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

Sorry for the ‘long post’ but I think you may need these details :sweat_smile:

This looks like a problem with cordova-plugin-x-socialsharing, not VoltBuilder. Others have reported similar problems to cordova-plugin-x-socialsharing on Android 13:

App close after share whatsapp last version android

Android 13 devices error on share with Twitter or Facebook

You’ll need contact the maintainer to see if there is an update.

Maybe someone will make a cordova-plugin-x-socialsharing-android13 plugin - there is one for Android 12. (Have you tried that?)

1 Like