Tharindu Lakshan
Tharindu Lakshan

Reputation: 6096

Uploaded App Bundle rejected due to 'android:exported' property set issue

I have made a release with a few changes to my application. But this time the Google Play console rejected the app due to the below reason. Was the error missed here?

I used Flutter SDK version 2.2.3.

The build.gradle file is as follows,

    defaultConfig {
        applicationId "com.testApp"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1.0
        versionName 1.0
    }

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

Enter image description here

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testApp">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" />
        </intent>
    </queries>

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="Test App"
        android:allowBackup="false"
        android:fullBackupContent="@xml/my_backup_rules">
        <service
            android:name=".AndroidNotificationService"
            android:exported="true"
            android:enabled="true"
             />

        <receiver android:exported="true" android:name=".NotificationServiceAutoStart">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">

            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>

</manifest>

Upvotes: 0

Views: 303

Answers (1)

Tharindu Lakshan
Tharindu Lakshan

Reputation: 6096

I have sorted out this issue. Here the problem was in the receiver.

I changed android:name=".NotificationServiceAutoStart"> into android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver".

The full code is as follows,

    <receiver
        android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

Upvotes: 1

Related Questions