dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
570 stars 457 forks source link

android:exported needs to be explicitly specified for element #842

Closed ebofi closed 6 months ago

ebofi commented 6 months ago

Hi,

We are using Monaca Cloud for our Cordova app, and below is our package.json

{
    "name": "app.mobile.app",
    "displayName": "Apps",
    "dependencies": {
        "com-sarriaroman-photoviewer": "1.3.0",
        "cordova-android": "^9.1.0",
        "cordova-plugin-actionsheet": "^2.3.3",
        "cordova-plugin-androidx-adapter": "^1.1.3",
        "cordova-plugin-apprate": "1.5.0",
        "cordova-plugin-buildinfo": "4.0.0",
        "cordova-plugin-camera": "4.1.0",
        "cordova-plugin-device": "2.0.3",
        "cordova-plugin-dialogs": "^2.0.2",
        "cordova-plugin-facebook4": "6.4.0",
        "cordova-plugin-file": "^6.0.2",
        "cordova-plugin-file-transfer": "1.7.1",
        "cordova-plugin-firebasex": "16.1.0-cli",
        "freshchat-phonegap": "github:techaffinity/freshchat-phonegap",
        "cordova-plugin-geolocation": "4.1.0",
        "cordova-plugin-googleplus": "8.5.1",
        "cordova-plugin-inappbrowser": "4.1.0",
        "cordova-plugin-media": "5.0.3",
        "cordova-plugin-network-information": "2.0.2",
        "cordova-plugin-request-location-accuracy": "2.3.0",
        "cordova-plugin-splashscreen": "6.0.0",
        "cordova-plugin-whitelist": "1.3.4",
        "cordova-plugin-x-socialsharing": "6.0.2",
        "cordova.plugins.diagnostic": "6.1.1",
        "es6-promise-plugin": "^4.2.2",
        "uk.co.workingedge.phonegap.plugin.launchnavigator": "5.0.4"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-whitelist": {},
            "com-sarriaroman-photoviewer": {},
            "cordova-plugin-buildinfo": {},
            "cordova-plugin-camera": {
                "ANDROID_SUPPORT_V4_VERSION": "27.+"
            },
            "cordova-plugin-device": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "2049491728632651",
                "APP_NAME": "Karenderia",
                "FACEBOOK_HYBRID_APP_EVENTS": "false",
                "FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"
            },
            "cordova-plugin-file-transfer": {},
            "cordova-plugin-geolocation": {
                "GPS_REQUIRED": "true"
            },
            "cordova-plugin-googleplus": {
                "REVERSED_CLIENT_ID": "com.googleusercontent.apps.46158489047-3a9m0f5gg4p9aemeo3vmh971dphtc3dn",
                "PLAY_SERVICES_VERSION": "17.0.0"
            },
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-media": {},
            "cordova-plugin-network-information": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-x-socialsharing": {},
            "cordova-plugin-request-location-accuracy": {
                "PLAY_SERVICES_VERSION": "17.0.0",
                "PLAY_SERVICES_LOCATION_VERSION": "16.+"
            },
            "uk.co.workingedge.phonegap.plugin.launchnavigator": {
                "GOOGLE_API_KEY_FOR_ANDROID": "",
                "OKHTTP_VERSION": "3.12.1"
            },
            "cordova-plugin-apprate": {},
            "cordova-plugin-androidx-adapter": {},
            "cordova-plugin-firebasex": {
                "ANDROID_ICON_ACCENT": "#FF11FF11",
                "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "false",
                "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "false",
                "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "false",
                "SETUP_RECAPTCHA_VERIFICATION": "false",
                "IOS_STRIP_DEBUG": "true",
                "ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false"

            },
            "cordova.plugins.diagnostic": {
                "ANDROIDX_VERSION": "1.0.0",
                "ANDROIDX_APPCOMPAT_VERSION": "1.3.1"
            }
        },
        "platforms": [
            "android"
        ]
    },
    "scripts": {
        "monaca:preview": "npm run dev",
        "dev": "browser-sync start -s www/ --watch --port 8080 --ui-port 8081"
    },
    "devDependencies": {
        "browser-sync": "^2.24.5",
        "cordova": "^10.0.0",
        "cordova-plugin-nativestorage": "^2.3.2",
        "freshchat-phonegap": "github:techaffinity/freshchat-phonegap"
    }
}

And in our config.xml we target these sdk

<?xml version="1.0" encoding="utf-8"?>
{
    "name": "app.mobile.app",
    "displayName": "apps",
    "dependencies": {
        "com-sarriaroman-photoviewer": "1.3.0",
        "cordova-android": "^9.1.0",
        "cordova-plugin-actionsheet": "^2.3.3",
        "cordova-plugin-androidx-adapter": "^1.1.3",
        "cordova-plugin-apprate": "1.5.0",
        "cordova-plugin-buildinfo": "4.0.0",
        "cordova-plugin-camera": "4.1.0",
        "cordova-plugin-device": "2.0.3",
        "cordova-plugin-dialogs": "^2.0.2",
        "cordova-plugin-facebook4": "6.4.0",
        "cordova-plugin-file": "^6.0.2",
        "cordova-plugin-file-transfer": "1.7.1",
        "cordova-plugin-firebasex": "16.1.0-cli",
        "freshchat-phonegap": "github:techaffinity/freshchat-phonegap",
        "cordova-plugin-geolocation": "4.1.0",
        "cordova-plugin-googleplus": "8.5.1",
        "cordova-plugin-inappbrowser": "4.1.0",
        "cordova-plugin-media": "5.0.3",
        "cordova-plugin-network-information": "2.0.2",
        "cordova-plugin-request-location-accuracy": "2.3.0",
        "cordova-plugin-splashscreen": "6.0.0",
        "cordova-plugin-whitelist": "1.3.4",
        "cordova-plugin-x-socialsharing": "6.0.2",
        "cordova.plugins.diagnostic": "6.1.1",
        "es6-promise-plugin": "^4.2.2",
        "uk.co.workingedge.phonegap.plugin.launchnavigator": "5.0.4"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-whitelist": {},
            "com-sarriaroman-photoviewer": {},
            "cordova-plugin-buildinfo": {},
            "cordova-plugin-camera": {
                "ANDROID_SUPPORT_V4_VERSION": "27.+"
            },
            "cordova-plugin-device": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "2049491728632651",
                "APP_NAME": "Karenderia",
                "FACEBOOK_HYBRID_APP_EVENTS": "false",
                "FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"
            },
            "cordova-plugin-file-transfer": {},
            "cordova-plugin-geolocation": {
                "GPS_REQUIRED": "true"
            },
            "cordova-plugin-googleplus": {
                "REVERSED_CLIENT_ID": "com.googleusercontent.apps.46158489047-3a9m0f5gg4p9aemeo3vmh971dphtc3dn",
                "PLAY_SERVICES_VERSION": "17.0.0"
            },
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-media": {},
            "cordova-plugin-network-information": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-x-socialsharing": {},
            "cordova-plugin-request-location-accuracy": {
                "PLAY_SERVICES_VERSION": "17.0.0",
                "PLAY_SERVICES_LOCATION_VERSION": "16.+"
            },
            "uk.co.workingedge.phonegap.plugin.launchnavigator": {
                "GOOGLE_API_KEY_FOR_ANDROID": "",
                "OKHTTP_VERSION": "3.12.1"
            },
            "cordova-plugin-apprate": {},
            "cordova-plugin-androidx-adapter": {},
            "cordova-plugin-firebasex": {
                "ANDROID_ICON_ACCENT": "#FF11FF11",
                "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "false",
                "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "false",
                "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "false",
                "SETUP_RECAPTCHA_VERIFICATION": "false",
                "IOS_STRIP_DEBUG": "true",
                "ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
                "ANDROID_PLAY_SERVICES_AUTH_VERSION": "19.0.0",
                "ANDROID_FIREBASE_ANALYTICS_VERSION": "18.0.2",
                "ANDROID_FIREBASE_MESSAGING_VERSION": "21.0.1",
                "ANDROID_FIREBASE_CONFIG_VERSION": "20.0.4",
                "ANDROID_FIREBASE_PERF_VERSION": "19.1.1",
                "ANDROID_FIREBASE_AUTH_VERSION": "20.0.3",
                "ANDROID_FIREBASE_FIRESTORE_VERSION": "22.1.1",
                "ANDROID_FIREBASE_FUNCTIONS_VERSION": "19.2.0",
                "ANDROID_FIREBASE_INSTALLATIONS_VERSION": "16.3.5",
                "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "17.4.0",
                "ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "17.4.0",
                "ANDROID_GSON_VERSION": "2.8.6",
                "ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.3.5"
            },
            "cordova.plugins.diagnostic": {
                "ANDROIDX_VERSION": "1.0.0",
                "ANDROIDX_APPCOMPAT_VERSION": "1.3.1"
            }
        },
        "platforms": [
            "android"
        ]
    },
    "scripts": {
        "monaca:preview": "npm run dev",
        "dev": "browser-sync start -s www/ --watch --port 8080 --ui-port 8081"
    },
    "devDependencies": {
        "browser-sync": "^2.24.5",
        "cordova": "^10.0.0",
        "cordova-plugin-nativestorage": "^2.3.2",
        "freshchat-phonegap": "github:techaffinity/freshchat-phonegap"
    }
}

And when we are building the app, we are getting the below errors on monaca


[16:21:26] > Task :app:processDebugMainManifest FAILED
[16:21:26] See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.
[16:21:26] /tmp/download/platforms/android/app/src/main/AndroidManifest.xml:20:9-24:20 Error:
[16:21:26]  android:exported needs to be explicitly specified for element <receiver#nl.xservices.plugins.ShareChooserPendingIntent>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
[16:21:26] FAILURE: Build failed with an exception.
[16:21:26] * What went wrong:
[16:21:26] Execution failed for task ':app:processDebugMainManifest'.
[16:21:26] > 
[16:21:26] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[16:21:26] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[16:21:26] See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings
[16:21:26] 26 actionable tasks: 26 executed
[16:21:26] Manifest merger failed : android:exported needs to be explicitly specified for element <receiver#nl.xservices.plugins.ShareChooserPendingIntent>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
[16:21:26] * Try:
[16:21:26] > Run with --stacktrace option to get the stack trace.
[16:21:26] > Run with --info or --debug option to get more log output.
[16:21:26] > Run with --scan to get full insights.
[16:21:26] * Get more help at https://help.gradle.org
[16:21:26] BUILD FAILED in 40s
[16:21:26] Command failed with exit code 1: /tmp/download/platforms/android/gradlew -b /tmp/download/platforms/android/build.gradle cdvBuildDebug
dpa99c commented 6 months ago

The cause of this error is clear from the build log:

android:exported needs to be explicitly specified for element <receiver#nl.xservices.plugins.ShareChooserPendingIntent>

This has nothing to do with this plugin - this line is added by the social sharing plugin.

Before reporting issues with this plugin, please first verify the problem using the example project or an isolated test case project to rule out other causes such as this in your own production projects.