Not able to publish on Google Play / android:exported / Android 12

Hello all,

I reaslied today that I can’t update my game anymore. The error I get is: “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: Behavior changes: Apps targeting Android 12  |  Android Developers

What I’ve tried already:

  • Updated Unity version to 2020.3.25.f1 - same error
  • With 2020.3.25.f1 and 2019.4.28f1 → I’ve selected “Custom Main Manifest” (Project Settings > Player > Android > Publishing Settings > Build), and added android:exported=“false” (one time) and android:exported=“true” (another time) in AndroidManifest.xml → but still same error

Does anyone know any other method that will fix the error and allow me to update the game? I have Target API Level: 32.

Thank you!!

We shared a solution to add automatically the exported flag in-case if you can’t update your unity version.
Have a look here .

I tested your method but it didn’t solve the problem.

Send me a dummy apk (with all scenes removed from the build settings) to have a look.
Most likely you may have other plugins which needs to add exported flag to manifest.

Thank you for your reply! I have sent an e-mail onto support@voxelbusters.com with an explanation and with the dummy apk you asked for (didn’t want to share it through here).

Send me a dm here instead :slight_smile:

So, the issue is that Google doesn’t let publishing an app bundle because of this android:exported flag.

What I’ve made so far:
Made a Custon Main Manifest and added android:exported=“true” inside the .
I’ve also updated my Unity to the latest version.
I “implemented” your script (it’s inside the Editor subforlder).

I have a NativeShare plugin as well. I have no idea how to add the exported flag onto this plugin and I’m not even sure if that’s causing the issue.
However, I found out that everytime I am building an apk or an app bundle, an AndroidManifest.xml get’s created which has it’s android:exported set to false (see in the screenshot I’ve attached).
Could it be, that I have to set each or one of these to true instead? Which ones?
And most importantly: how? Do I have to copy this and make a Custom Gradle Temlate and then copy all this inside with setting these exported flags to true? If yes, which one of the Gradle Templades do I have to create? There’s a bunch of options for that inside Unitys Player Settings > Publishing Settings > Build.

I have sent the apk in DM.

Try to create a new empty project, build it and see if the issue is reproducible. If it is not reproducible, add the NativeShare plugin and see if the issue becomes reproducible. Most likely that plugin adds its own activity, activity alias, service or broadcast receiver with intent filter which does not specify android:exported property. You will have to look for a new plugin version which has this fixed.
I expect this issue will be caused by the plugin, because you use Unity 2020.3.25.f1 which already adds android:exported property for Unity activity.

android:exported property is specified for Unity activity starting with these versions: 2019.4.33f1, 2020.3.22f1, 2021.1.20f1 and 2021.2.0b11.

1 Like

When I create a new custom main manifest in 2020.3.26f1 (and I believe also 2021.2.8f1) the generated AndroidManifest.xml does not contain the android:exported property.

Shouldn’t it?

Well, the NativeShare is causing the issue, I’m pretty sure. It has it’s android:exported set to false. I tried to override it with a Custom Main Mainfest (copy-pasted and changed from false to true) but that is somehow not merging.
Isn’t there any other solution than removing this plugin? Can’t I somehow set it to true instead of implementing a whole another plugin?
If it’s necesseraly, can you suggest me any other, which has been already updated?

Thanks for sharing the empty apk to look into.
Your project has mobile notifications plugin which is adding the below entry in the manifest.

        <receiver android:name="com.unity.androidnotifications.UnityNotificationRestartOnBootReceiver" android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>

Solution is mentioned over here and listing the same below.
As per Android 12,

So either you need to grab a latest version of that plugin (if they fix it) or delete it if you don’t use it.

3 Likes

Thank you so-so much for helping me with that!
I have never thought, not even for a second that Unitys “dedicated” package is going to cause this issue…
I deleted it and all the referred codes, now it works. I also found an asset in the store which has an update for Android 12, implementing that.

Thank you again, you literally saved me there!

1 Like

No, it gets added during the build, so the manifest template in Unity project’s Plugins/Android will not have it, but the manifest in the exported gradle project (or built app) will have it.

Seems a bit counter-intuitive to me (but I guess this way it gets fixed even in projects that already use a custom manifest).

Thanks for clearing that up.

Hello!
I got the same error: “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: Behavior changes: Apps targeting Android 12  |  Android Developers”.
But I don’t have the mobile notifications plugin installed.

Share me an empty apk to look into.

@razvanbugneriu I checked the apk you sent me on a DM and sent you the reason. Contact the publisher of that plugin to get an updated version.

test use target 31. 32 not Stable

What do you mean?

This is workaround