Unity android 12 with android:exported attribute issue

4.1k Views Asked by At

I would like to build the game in android 12. I know I need to add the android:exported="true" into activity tag which included intent-filter.
So I already added the android:exported="true" into activity tag in my AndroidManifest.xml. But I built on the android 12 device is still has error.

Installation failed due to: 'Failed to commit install session 1567366667 with command cmd package install-commit 1567366667. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1567366667.tmp/base.apk (at Binary XML file line #136): com.unity.purchasing.googleplay.VRPurchaseActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'

But I don't know what is VRPurchaseActivity and I don't add this activity to my AndroidManifest.xml.
So anyone know how to fix this issue. Thank a lots.

2

There are 2 best solutions below

0
On

The activity comes from Unity but there is a way to override its attributes. Put this inside your manifest:

<activity android:name="com.unity.purchasing.googleplay.VRPurchaseActivity">
android:exported="false"
tools:node="merge" />
0
On

If you added the android:exported="true" line but not working on google play console upload, you can try this way.

remove all this files:

  1. ..\Temp\gradleOut\unityLibrary\build\intermediates\library_manifest\release\AndroidManifest.xml

  2. ..\ProjectSetting\AndroidResolverDependencies.xml

and then build it again