xamarin 使用 Android 12 编辑 AndroidManifest 上传应用程序到 Play 商店时出现问题

问题描述 投票:0回答:1

我不明白我需要使用这个

exported
标志编辑什么 AndroidManifest 才能使此错误在 Play 商店中消失。我已经编辑了
Properties
obj\Debug\130\android
中的文件,但它不会删除此警告消息

错误信息

You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="30302" android:versionName="3.0.2" package="xxx.xxxx.nccn" android:installLocation="auto">
  <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
  <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
  <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />
  <uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
  <uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />
  <uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
  <uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE" />
  <uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />
  <uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE" />
  <uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
  <uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
  <uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.READ_APP_BADGE" />
  <uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" />
  <uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />
  <uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ" />
  <uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE" />
  <application android:label="Patient Guides" android:largeHeap="true" android:usesCleartextTraffic="true" android:icon="@drawable/appicon" android:name="androidx.multidex.MultiDexApplication" android:allowBackup="true" android:debuggable="false" android:extractNativeLibs="true">
    <activity android:label="Patient Guides" android:theme="@style/SplashTheme" android:name="crc6487aefd3090b7ea5e.SplashActivity" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:configChanges="orientation|screenSize" android:icon="@mipmap/icon" android:label="PatientGuidelinesApp.Droid" android:theme="@style/MainTheme" android:name="crc64b130862e93296c81.MainActivity" android:exported="false"/>
    <receiver android:permission="com.google.android.c2dm.permission.SEND" android:name="crc64a93b901f58a35d0f.PushReceiver" android:exported="false">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <category android:name="com.mediaparts.nccn" />
      </intent-filter>
    </receiver>
    <service android:name="crc64a93b901f58a35d0f.TokenService" android:exported="false">
      <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
      </intent-filter>
    </service>
    <service android:name="crc64396a3fe5f8138e3f.KeepAliveService" android:exported="false" />
    <receiver android:enabled="true" android:label="Essentials Battery Broadcast Receiver" android:name="crc64a0e0a82d0db9a07d.BatteryBroadcastReceiver" android:exported="false" />
    <receiver android:enabled="true" android:label="Essentials Energy Saver Broadcast Receiver" android:name="crc64a0e0a82d0db9a07d.EnergySaverBroadcastReceiver" android:exported="false" />
    <receiver android:enabled="true" android:label="Essentials Connectivity Broadcast Receiver" android:name="crc64a0e0a82d0db9a07d.ConnectivityBroadcastReceiver" android:exported="false" />
    <provider android:authorities="XXX.XXXfileProvider" android:exported="false" android:grantUriPermissions="true" android:name="xamarin.essentials.fileProvider">
      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/xamarin_essentials_fileprovider_file_paths" />
    </provider>
    <receiver android:enabled="true" android:name="crc643f46942d9dd1fff9.PowerSaveModeBroadcastReceiver" android:exported="false" />
    <provider android:name="mono.android.MultiDexLoader" android:exported="false" android:initOrder="1999999999" android:authorities="XXX.XXXmono.android.MultiDexLoader.__mono_init__" />
    <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="1999999998" android:authorities="XXX.XXXmono.MonoRuntimeProvider.__mono_init__" />
    <!--
             FirebaseMessagingService performs security checks at runtime,
             no need for explicit permissions despite exported="true"
        -->
    <service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="false">
      <intent-filter android:priority="-500">
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <activity android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <activity android:name="com.microsoft.appcenter.distribute.DeepLinkActivity" android:theme="@android:style/Theme.NoDisplay" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:host="updates" android:path="/" android:scheme="appcenter" />
      </intent-filter>
    </activity>
    <receiver android:name="com.microsoft.appcenter.distribute.DownloadManagerReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
        <action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
      </intent-filter>
    </receiver>
    <receiver android:name="com.onesignal.NotificationOpenedReceiver" android:exported="false" />
    <service android:name="com.onesignal.GcmIntentService" android:exported="false" />
    <service android:name="com.onesignal.GcmIntentJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" />
    <service android:name="com.onesignal.RestoreJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" />
    <service android:name="com.onesignal.RestoreKickoffJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" />
    <service android:name="com.onesignal.SyncService" android:stopWithTask="true" android:exported="false" />
    <service android:name="com.onesignal.SyncJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" />
    <activity android:name="com.onesignal.PermissionsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="false" />
    <service android:name="com.onesignal.NotificationRestoreService" android:exported="false" />
    <receiver android:name="com.onesignal.BootUpReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
      </intent-filter>
    </receiver>
    <receiver android:name="com.onesignal.UpgradeReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
      </intent-filter>
    </receiver>
    <provider android:name="com.pdftron.pdfnet.PDFNetInitializer" android:authorities="XXX.XXXpdftron-pdfnet" android:exported="false" />
    <provider android:name="com.pdftron.pdf.utils.PDFTronToolsInitializer" android:authorities="XXX.XXXpdftron-tools" android:exported="false" />
    <provider android:name="com.pdftron.pdfnet.PDFNetInitializer" android:authorities="XXX.XXXpdftron-pdfnet" p6:node="remove" xmlns:p6="http://schemas.android.com/tools" android:exported="false"/>
    <provider android:name="com.pdftron.pdf.utils.ShareProvider" android:authorities="XXX.XXXpdftron.fileprovider" android:exported="false" android:grantUriPermissions="true">
      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
    </provider>
    <provider android:name="com.google.firebase.provider.FirebaseInitProvider" android:authorities="XXX.XXXfirebaseinitprovider" android:exported="false" android:initOrder="100" />
    <service android:name="com.google.firebase.components.ComponentDiscoveryService" android:exported="false">
      <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar" />
    </service>
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="false" android:permission="com.google.android.c2dm.permission.SEND">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
      </intent-filter>
    </receiver>
    <!--
             FirebaseInstanceIdService performs security checks at runtime,
             no need for explicit permissions despite exported="true"
        -->
    <service android:name="com.google.firebase.iid.FirebaseInstanceIdService" android:exported="false">
      <intent-filter android:priority="-500">
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
      </intent-filter>
    </service>
    <!--
             FirebaseMessagingService performs security checks at runtime,
             no need for explicit permissions despite exported="true"
        -->
    <service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="false">
      <intent-filter android:priority="-500">
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>
    <activity android:name="com.microsoft.appcenter.distribute.DeepLinkActivity" android:theme="@android:style/Theme.NoDisplay" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:host="updates" android:path="/" android:scheme="appcenter" />
      </intent-filter>
    </activity>
    <receiver android:name="com.microsoft.appcenter.distribute.DownloadManagerReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
        <action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED" />
      </intent-filter>
    </receiver>
    <receiver android:name="com.onesignal.NotificationOpenedReceiver" android:exported="false"/>
    <service android:name="com.onesignal.GcmIntentService" android:exported="false"/>
    <service android:name="com.onesignal.GcmIntentJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false"/>
    <service android:name="com.onesignal.RestoreJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false"/>
    <service android:name="com.onesignal.RestoreKickoffJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false"/>
    <service android:name="com.onesignal.SyncService" android:stopWithTask="true" android:exported="false"/>
    <service android:name="com.onesignal.SyncJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false"/>
    <activity android:name="com.onesignal.PermissionsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="false"/>
    <service android:name="com.onesignal.NotificationRestoreService" android:exported="false"/>
    <receiver android:name="com.onesignal.BootUpReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
      </intent-filter>
    </receiver>
    <receiver android:name="com.onesignal.UpgradeReceiver" android:exported="false">
      <intent-filter>
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
      </intent-filter>
    </receiver>
    <provider android:name="com.pdftron.pdfnet.PDFNetInitializer" android:authorities="XXX.XXXpdftron-pdfnet" android:exported="false" />
    <provider android:name="com.pdftron.pdf.utils.PDFTronToolsInitializer" android:authorities="XXX.XXXpdftron-tools" android:exported="false" />
    <provider android:name="com.pdftron.pdfnet.PDFNetInitializer" android:authorities="XXX.XXXpdftron-pdfnet" p6:node="remove" xmlns:p6="http://schemas.android.com/tools" android:exported="false"/>
    <provider android:name="com.pdftron.pdf.utils.ShareProvider" android:authorities="XXX.XXXpdftron.fileprovider" android:exported="false" android:grantUriPermissions="true">
      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
    </provider>
    <provider android:name="com.google.firebase.provider.FirebaseInitProvider" android:authorities="XXX.XXXfirebaseinitprovider" android:initOrder="100" android:exported="false"/>
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:permission="com.google.android.c2dm.permission.SEND" android:exported="false">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
      </intent-filter>
    </receiver>
    <!--
             FirebaseInstanceIdService performs security checks at runtime,
             no need for explicit permissions despite exported="true"
        -->
    <service android:name="com.google.firebase.iid.FirebaseInstanceIdService" android:exported="false">
      <intent-filter android:priority="-500">
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
      </intent-filter>
    </service>
  </application>
</manifest>
android xamarin.forms xamarin.android google-play
1个回答
0
投票

*您提供的错误消息表明您的 AndroidManifest.xml 文件中的组件(活动、服务、接收器)具有意图过滤器,但 android:exported 属性未显式设置。这会导致问题,因为从 Android 12 开始,具有 Intent 过滤器的组件必须显式定义 android:exported 属性。

要解决此问题,您需要检查清单文件并为每个具有意图过滤器的组件设置 android:exported 属性。根据 Android 12 行为,您有两种设置此属性的选项:true 或 false。

<activity android:name="init.SplashActivity" android:exported="false"> // true or false
<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
© www.soinside.com 2019 - 2024. All rights reserved.