上传App至Google Play遇android:exported未设置错误求助
解决Google Play上传的Android 12+导出属性错误
Android 12及更高版本要求,所有带有<intent-filter>的Activity、Service、Broadcast Receiver必须显式声明android:exported属性,明确指定该组件是否允许被外部应用调用。你的Manifest里有三个组件符合条件但未设置该属性,修改如下:
需要调整的组件
- MainActivity:包含接收外部链接和自定义Action的intent filter,需设置
android:exported="true" - ShareActivity:接收系统分享的intent,需设置
android:exported="true" - Firebase服务:仅处理Firebase内部事件,设置
android:exported="false"
修改后的完整Manifest代码
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.aishcrypt.transfer" android:installLocation="auto"> <supports-screens android:anyDensity="true" android:resizeable="true" android:smallScreens="true" android:largeScreens="true" android:normalScreens="true" android:xlargeScreens="true" /> <!-- remove permissions that your app doesn't require; asking for authority over unwanted information can cause damage to your reputation among your users --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <!-- remove location.gps feature if not using permission ACCESS_FINE_LOCATION --> <uses-feature android:name="android.hardware.location.gps" /> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <!--<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />--> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/SplashTheme" android:hardwareAccelerated="true" android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true" tools:ignore="AllowBackup,UnusedAttribute"> <activity android:name="com.aishcrypt.transfer.SplashScreen" android:label="@string/app_name" android:screenOrientation="portrait" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.aishcrypt.transfer.MainActivity" android:screenOrientation="portrait" android:exported="true"> <!-- remove or alter as your apps requirement --> <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="apps.mgks.dev" android:pathPrefix="/swv" /> <!-- if you want only a specific directory from your website to be opened in the app through external links --> </intent-filter> <intent-filter android:label="OpenURI"> <action android:name="Open_URI" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name="com.aishcrypt.transfer.ShareActivity" android:exported="true"> <intent-filter android:label="Share"> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/*" /> <!-- <data android:mimeType="image/*" /> --> </intent-filter> </activity> <!--<receiver android:name=".NotificationPausePlay" />--> <service android:name="com.aishcrypt.transfer.Firebase" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="@string/app_id"/> </application> </manifest>
内容的提问来源于stack exchange,提问作者Tauisif Ahmad
相关产品推荐
相关产品推荐

