需要为元素 <receiver#nl.xservices.plugins.ShareChooserPendingIntent 显式指定 android:exported>

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

提问人:Stephen Enathu 提问时间:11/3/2023 更新时间:11/3/2023 访问量:29

问:

我的应用程序代码有点旧,所以现在我正在尝试再次编译应用程序。因此,我们遇到了一些错误,该错误与我们假设的 firebase 插件有关,我们正在使用 Monaca Cloud 来构建我们的 cordova 应用程序。

我们的Pacakage.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": "Apps",
                "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"
    }
}

我们的 Config.XMl

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="app.mobile.app" versionCode="26.0.0" version="26.0.0">
  <name>Apps</name>
  <description>
        Apps
    </description>
  <author email="[email protected]" href="http://cordova.io">
        Apps
    </author>
  <content src="index.html"/>
  <preference name="AndroidXEnabled" value="true"/>
  <preference name="android-minSdkVersion" value="22"/>
  <preference name="android-targetSdkVersion" value="33"/>
   <preference name="android-compileSdkVersion" value="33"/>

  <allow-navigation href="*"/>
  <allow-intent href="itms:*"/>
  <allow-intent href="itms-apps:*"/>
  <gap:config-file platform="android" parent="/manifest">
    <supports-screens android:xlargeScreens="true" android:largeScreens="true" android:smallScreens="true"/>
    <application android:theme="@android:style/Theme.NoTitleBar">
        </application>
  </gap:config-file>
  <platform name="android">
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
      <application android:usesCleartextTraffic="true"/>
    </edit-config>
    <config-file target="AndroidManifest.xml" parent="/*/application">
      <uses-library android:name="org.apache.http.legacy" android:required="true"/>
    </config-file>
    <resource-file src="www/beep.wav" target="app/src/main/res/raw/beep.wav"/>
    <resource-file src="google-services.json" target="google-services.json"/>
    <resource-file src="google-services.json" target="app/google-services.json"/>
    <icon density="ldpi" src="res/icons/android/ldpi.png"/>
    <icon density="mdpi" src="res/icons/android/mdpi.png"/>
    <icon density="hdpi" src="res/icons/android/hdpi.png"/>
    <icon density="xhdpi" src="res/icons/android/xhdpi.png"/>
    <icon density="xxhdpi" src="res/icons/android/xxhdpi.png"/>
    <icon density="xxxhdpi" src="res/icons/android/xxxhdpi.png"/>
    <preference name="AndroidWindowSplashScreenBackground" value="#468fff"/>
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/android/screen/window_splashscreen_icon.png"/>
  </platform>
  <platform name="ios">
    <allow-intent href="tel:*"/>
    <allow-navigation href="tel:*"/>
    <allow-intent href="mailto:*"/>
    <allow-navigation href="mailto:*"/>
    <resource-file src="www/beep.wav"/>
    <preference name="WKWebViewOnly" value="true"/>
    <feature name="CDVWKWebViewEngine">
      <param name="ios-package" value="CDVWKWebViewEngine"/>
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine"/>
    <preference name="scheme" value="monaca-app"/>
    <preference name="hostname" value="localhost"/>
    <icon height="20" platform="ios" src="res/icons/ios/icon-20.png" width="20"/>
    <icon height="57" platform="ios" src="res/icons/ios/icon.png" width="57"/>
    <icon height="114" platform="ios" src="res/icons/ios/[email protected]" width="114"/>
    <icon height="40" platform="ios" src="res/icons/ios/icon-40.png" width="40"/>
    <icon height="80" platform="ios" src="res/icons/ios/[email protected]" width="80"/>
    <icon height="50" platform="ios" src="res/icons/ios/icon-50.png" width="50"/>
    <icon height="100" platform="ios" src="res/icons/ios/[email protected]" width="100"/>
    <icon height="60" platform="ios" src="res/icons/ios/icon-60.png" width="60"/>
    <icon height="120" platform="ios" src="res/icons/ios/[email protected]" width="120"/>
    <icon height="180" platform="ios" src="res/icons/ios/[email protected]" width="180"/>
    <icon height="72" platform="ios" src="res/icons/ios/icon-72.png" width="72"/>
    <icon height="144" platform="ios" src="res/icons/ios/[email protected]" width="144"/>
    <icon height="76" platform="ios" src="res/icons/ios/icon-76.png" width="76"/>
    <icon height="152" platform="ios" src="res/icons/ios/[email protected]" width="152"/>
    <icon height="29" platform="ios" src="res/icons/ios/icon-small.png" width="29"/>
    <icon height="58" platform="ios" src="res/icons/ios/[email protected]" width="58"/>
    <icon height="87" platform="ios" src="res/icons/ios/[email protected]" width="87"/>
    <icon height="1024" platform="ios" src="res/icons/ios/icon-1024.png" width="1024"/>
    <icon height="167" platform="ios" src="res/icons/ios/[email protected]" width="167"/>
    <splash src="res/screens/ios/Default@2x~universal~anyany.png"/>
    <splash src="res/screens/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/screens/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/screens/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/screens/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/screens/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/screens/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
    <splash src="res/screens/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/screens/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/screens/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/screens/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <config-file platform="ios" target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
      <string>This allows us to use your location to provide you a nearby restaurant, and to facilitate more accurately, keeping you in the loop about Food-Aw.</string>
    </config-file>
    <config-file platform="ios" target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
      <string>This allows us to use your location to provide you a nearby restaurant, and to facilitate more accurately, keeping you in the loop about Food-Aw.</string>
    </config-file>
    <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
      <string>Enable Food-Aw to access your camera to take photos of you and to save as profile picture.</string>
    </edit-config>
    <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
      <string>Enable Food-Aw to access your photo library to get pictures from there.</string>
    </edit-config>
    <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
      <string>This allows us to use your location to find restaurant nearby.</string>
    </edit-config>
    <edit-config target="NSLocationAlwaysAndWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
      <string>This allows us to use your location to provide you a nearby restaurant, and to facilitate more accurately, keeping you in the loop about Food-Aw.</string>
    </edit-config>
    <edit-config target="NSLocationAlwaysUsageDescription" file="*-Info.plist" mode="merge">
      <string>This allows us to use your location to find restaurant nearby.</string>
    </edit-config>
    <edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
      <string>Enable Food-Aw to access your photo library to save pictures there.</string>
    </edit-config>
    <edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
      <string>need microphone access to record sounds</string>
    </edit-config>
    <edit-config target="NSBluetoothAlwaysUsageDescription" file="*-Info.plist" mode="merge">
      <string>Improve location accuracy when finding nearby restaurant</string>
    </edit-config>
    <edit-config target="NSBluetoothPeripheralUsageDescription" file="*-Info.plist" mode="merge">
      <string>Improve location accuracy when finding nearby restaurant</string>
    </edit-config>
    <edit-config target="NSContactsUsageDescription" file="*-Info.plist" mode="merge">
      <string>Need access to your contacts</string>
    </edit-config>
    <edit-config target="NSCalendarsUsageDescription" file="*-Info.plist" mode="merge">
      <string>Need acces to calendar</string>
    </edit-config>
    <edit-config target="NSMotionUsageDescription" file="*-Info.plist" mode="merge">
      <string>Improve location accuracy when finding nearby restaurant</string>
    </edit-config>
  </platform>
  <preference name="WindowsStorePublisherName" value="My Name"/>
  <preference name="WindowsStoreIdentityName" value="784321d4-bab8-3957-d0a2-426559520ecc"/>
  <preference name="ios-XCBuildConfiguration-TARGETED_DEVICE_FAMILY" value="1"/>
  <preference name="AutoHideSplashScreen" value="false"/>
  <preference name="FadeSplashScreen" value="false"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="EnableViewportScale" value="false"/>
  <access origin="*"/>
  <access origin="tel:*"/>
  <preference name="KeepRunning" value="true"/>
  <preference name="monaca:AndroidIsPackageNameSeparate" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="Orientation" value="default"/>
  <preference name="SplashScreenDelay" value="0"/>
  <preference name="Fullscreen" value="false"/>
</widget>

运行调试构建后,我们收到此错误,不知道确切是哪个插件或为什么会出现此错误并修复它

[16:35:47] > Task :app:processDebugMainManifest
[16:35:47]  FAILED
[16:35:47] /tmp/download/platforms/android/app/src/main/AndroidManifest.xml:20:9-24:20 Error:
[16:35:47] See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.
[16:35:47]  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:35:47] FAILURE: 
[16:35:47] Build failed with an exception.
[16:35:47] * What went wrong:
[16:35:47] Execution failed for task ':app:processDebugMainManifest'.
[16:35:47] > 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:35:47] * Try:
[16:35:47] > Run with --stacktrace option to get the stack trace.
[16:35:47] > Run with --info or --debug option to get more log output.
[16:35:47] > Run with --scan
[16:35:47] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[16:35:47] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[16:35:47] See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings
[16:35:47] 23 actionable tasks: 23 executed
[16:35:47]  to get full insights.
[16:35:47] * Get more help at https://help.gradle.org
[16:35:47] BUILD FAILED in 29s
[16:35:47] Command failed with exit code 1: /tmp/download/platforms/android/gradlew -b /tmp/download/platforms/android/build.gradle cdvBuildDebug
Android gradle cordova-plugins

评论


答: 暂无答案