上传Ionic应用至Google Play Store遇android:exported属性缺失报错
解决Ionic应用上传Google Play Store时的Android 12导出属性错误
上传应用到Google Play Store时收到以下错误:
您上传的APK或Android App Bundle中存在带有intent filter的activity、activity alias、service或broadcast receiver,但未设置'android:exported'属性。该文件无法在Android 12或更高版本上安装。
查看你提供的AndroidManifest.xml,有三个带intent filter的组件缺少android:exported属性,按以下方式修改即可解决:
修改逻辑说明
Android 12及以上版本强制要求:所有包含intent filter的组件必须显式声明android:exported,明确组件是否允许被外部应用访问:
android:exported="true":允许外部应用调用该组件android:exported="false":仅允许应用内部调用
具体修改项:
- 广播接收器
nl.xservices.plugins.ShareChooserPendingIntent:
它接收android.intent.action.SEND动作,需要被外部应用触发,添加android:exported="true" - 广播接收器
com.onesignal.ADMMessageHandler$Receiver:
处理亚马逊推送内部逻辑,仅需内部访问,添加android:exported="false" - Activity
com.google.zxing.client.android.encode.EncodeActivity:
用于生成二维码,仅内部使用,添加android:exported="false"
修改后的完整AndroidManifest.xml代码
<?xml version='1.0' encoding='utf-8'?> <manifest android:hardwareAccelerated="true" android:versionCode="10006" android:versionName="1.0.6" package="io.givllyfilos.edhub" xmlns:android="http://schemas.android.com/apk/res/android"> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true"> <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"> <intent-filter android:label="@string/launcher_name"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <provider android:authorities="${applicationId}.emailcomposer.provider" android:exported="false" android:grantUriPermissions="true" android:name="de.appplant.cordova.emailcomposer.Provider"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/emailcomposer_provider_paths" /> </provider> <receiver android:enabled="true" android:exported="true" android:name="nl.xservices.plugins.ShareChooserPendingIntent"> <intent-filter> <action android:name="android.intent.action.SEND" /> </intent-filter> </receiver> <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" /> </provider> <amazon:enable-feature android:name="com.amazon.device.messaging" android:required="false" xmlns:amazon="http://schemas.amazon.com/apk/res/android" /> <service android:exported="false" android:name="com.onesignal.ADMMessageHandler" /> <receiver android:exported="false" android:name="com.onesignal.ADMMessageHandler$Receiver" android:permission="com.amazon.device.messaging.permission.SEND"> <intent-filter> <action android:name="com.amazon.device.messaging.intent.REGISTRATION" /> <action android:name="com.amazon.device.messaging.intent.RECEIVE" /> <category android:name="io.givllyfilos.edhub" /> </intent-filter> </receiver> <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" /> <activity android:exported="false" android:label="Share" android:name="com.google.zxing.client.android.encode.EncodeActivity" /> <meta-data android:name="launchnavigator.GOOGLE_API_KEY" android:value="AIzaSyAo-TVesQ37IzUMhCDkpEn6REyeLyFO6as" /> </application> <uses-permission android:name="android.permission.FLAG_GRANT_READ_URI_PERMISSION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <queries> <package android:name="com.google.android.gm" /> <package android:name="com.microsoft.office.outlook" /> <package android:name="com.yahoo.mobile.client.android.mail" /> <intent> <action android:name="android.support.customtabs.action.CustomTabsService" /> </intent> </queries> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-feature android:name="android.hardware.telephony" android:required="false" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-feature android:name="android.hardware.location.gps" android:required="true" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" /> <permission android:name="io.givllyfilos.edhub.permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="io.givllyfilos.edhub.permission.RECEIVE_ADM_MESSAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.FLASHLIGHT" /> <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> </manifest>
内容的提问来源于stack exchange,提问作者Nasyx Nadeem
相关产品推荐
相关产品推荐

