1

After uploading my app to the google play store for internal testing, I get the following error message:

You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without the '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

I've tried setting the android:exported="true" in my manifest like so:

<receiver 
    android:name="com.ryanheise.audioservice.MediaButtonReceiver"
    android:exported="true"
>            
    <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
    </intent-filter>
</receiver>

But I'm still getting the same error. In my build.gradle files I have these configs:

compileSdkVersion 31
minSdkVersion 21
targetSdkVersion 31

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
    }
}

Feels like I have tried everything. Could this be an SDK version issue, or what could I be missing here?

Majoren
  • 983
  • 5
  • 16
  • 36

3 Answers3

3

What is exported receiver?

android:exported. Whether the broadcast receiver can receive messages from non-system sources outside its application — ” true ” if it can, and ” false ” if not.

You need to add the exported attribute for each of the activity pages in your AndroidManifest.xml file.

Example :

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

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat">
        <activity android:name="com.nisaefendioglu.weather.view.MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Nisa Efendioglu
  • 901
  • 3
  • 12
  • 22
  • Yes, I have added it both to my activity and to my receiver, still the same issue. – Majoren Mar 11 '22 at 13:12
  • The libraries you use in your project may be incompatible, you can try to update them to the latest version. @Majoren – Nisa Efendioglu Mar 11 '22 at 13:17
  • If the answer is insufficient for you, you can take a look at this answer. Hopefully it benefits your business. :) https://stackoverflow.com/a/70697686/11902787 @Majoren – Nisa Efendioglu Mar 11 '22 at 13:22
  • 1
    Thank you! It turned out I still had places where I needed to add the exported="true". Did a search through all my files and found a which was missing the attribute :) – Majoren Mar 11 '22 at 13:50
  • 1
    I'm very happy! good work. :) @Majoren – Nisa Efendioglu Mar 11 '22 at 13:52
1

Also note that running the "flutter clean" and then the "flutter pub get" command in the project folder might be needed to capture the changes whenever you modify an "essential" file like a .xml file.

Igbokwenu
  • 51
  • 3
1

As the accepted answer provides some ambiguous info and requires people to go through comments to understand solution I would write a proper answer.

The reason of the issue is missing exported property in one of declared components (activity, service or broadcast receiver) in AndroidManifest.xml file of the app. Since Android 12 every of listed components must declare this property for security reasons.

Here is a documentation about exported property for these components: