uploaded an APK which has an activity,activity alias,service or broadcast receiver with intentfilter, but without 'android : exported' property set

7,204

Solution 1

I added android:exported="true" to my main activity, but that didn't fix the issue for me.

However, I suspected this is a change that some packages have only recently implemented. I checked my pub outdated, and had a few older versions of key packages (in my case I was a major version behind on firebase storage). Once I had updated to the latest possible versions in pubspec.yaml the compiled file was accepted on upload to the play store.

Solution 2

I face the same Issue but i solved by writing android:exported="true" in activity bellow the android:name=".MainActivity" image shown

Solution 3

On our about the 11th of January, the Play Store introduced a lint check when uploading APKs to verify exported attributes are set correctly in the manifest.

Tools like DexGuard that obfuscate attribute names will cause the Play Store linter to fail, since it will be unable to check for exported attributes.

To fix this, configure obfuscation tools to keep attribute names in the manifest.
Here is the rule we used for DexGuard:

-keepresourcexmlattributenames manifest/**

Solution 4

In Your manifest file check all the activities, services , receiver that uses intent-filter without android:exported tag. In your main manifest file you can simply add android:exported property to activity tag so add android:exported="" and set a boolean value inside these quotation marks. Now you might ask when do I need to add android:exported="true" or android:exported="false" to the activities, services, or broadcast receivers that use intent filters. If the app component includes the LAUNCHER category, set android:exported to true. In most other cases, set android:exported to false.

Note : also check individual third party library manifest files if there is any activity , service or receiver using then you have to override same activity , service or receiver in your main manifest file with android:exported property.

for more explanation you can refer to my answer on same problem.

Solution 5

If your app targets Android 12 or higher and contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the android:exported attribute for these app components.

If the app component includes the LAUNCHER category, set android:exported to true. In most other cases, set android:exported to false.

The following code snippet shows an example of a service that contains an intent filter whose android:exported attribute is set to false:

<service android:name="com.example.app.backgroundService"
         android:exported="false">
    <intent-filter>
        <action android:name="com.example.app.START_BACKGROUND" />
    </intent-filter>
</service>

 <receiver android:name="com.example.app.serives.SilentPushReceiver"
            android:exported="false">
            <intent-filter>
                <!-- Receive silent push notifications. -->
                <action 
                android:name="uz.usoft.kidya.action.ymp.SILENT_PUSH_RECEIVE"/>
            </intent-filter>
</receiver>

<activity android:name="com.example.app.SplashScreenActivity"
            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.example.app.MainActivity"
            android:exported="false"/>

About info: https://developer.android.com/about/versions/12/behavior-changes-12#exported

Share:
7,204
vaibhav sharma
Author by

vaibhav sharma

Updated on January 03, 2023

Comments

  • vaibhav sharma
    vaibhav sharma over 1 year

    I'm having an issue when i'm uploading app bundle to the play console that 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. but my manifest file includes the property.

    Manifest file

        <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="**********">
            <!-- io.flutter.app.FlutterApplication is an android.app.Application that
                 calls FlutterMain.startInitialization(this); in its onCreate method.
                 In most cases you can leave this as-is, but you if you want to provide
                 additional functionality it is fine to subclass or reimplement
                 FlutterApplication and put your custom class here. -->
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.CAMERA" />
            <uses-feature android:name="android.hardware.camera" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
            <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
            <uses-permission android:name="android.permission.WAKE_LOCK"/>
            <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
            <uses-permission android:name="android.permission.VIBRATE" />
            <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
            <uses-permission android:name="android.permission.WAKE_LOCK" />
            <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
            <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
        
        
            <application
                android:name="io.flutter.app.FlutterApplication"
                android:label="*****"
                android:requestLegacyExternalStorage="true"
                android:usesCleartextTraffic="true"
                android:icon="@mipmap/ic_launcher">
        
        
                <meta-data
                  android:name="com.google.firebase.messaging.default_notification_icon"
                  android:resource="@drawable/ic_stat_artboard_1" />
        
                <meta-data android:name="com.google.android.geo.API_KEY"
                    android:value="Z*********"/>
        
                <provider
                    android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
                    android:authorities="im.mingguang.mingguang_app.flutter_downloader.provider"
                    android:grantUriPermissions="true"
                    android:requestLegacyExternalStorage="true">
                    <meta-data
                        android:name="android.support.FILE_PROVIDER_PATHS"
                        android:resource="@xml/provider_paths"/>
                </provider>
        
                <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>
                <activity
                    android:name=".MainActivity"
                    android:launchMode="singleTop"
                    android:theme="@style/LaunchTheme"
                    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                    android:hardwareAccelerated="true"
                    android:exported="true"
                    android:windowSoftInputMode="adjustResize">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.DEFAULT"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                    <intent-filter>
                        <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                        <category android:name="android.intent.category.DEFAULT"/>
                    </intent-filter>
                </activity>
                <!-- Don't delete the meta-data below.
                     This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
                <meta-data
                    android:name="flutterEmbedding"
                    android:value="2" />
            </application>
        </manifest>
    

    Play Console Error

    enter image description here