Android Manifest merger not working when building APK in Unity 2022.2

I am using Unity 2022.2.1f1 to develop a VR game for Meta Quest, and trying to build an Android APK.

Meta doesn't allow APKs uploaded to their store with permissions that are not needed, but Unity includes includes android.permission.RECORD_AUDIO and android.permission.MODIFY_AUDIO_SETTINGS by default since Meta's Interaction SDK uses the Microphone API at some point.

In the past (using Unity 2021.3.9f1), I fixed this by using a custom Unity Library Manifest that included

xmlns:tools="http://schemas.android.com/tools"

and

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" tools:node="remove" />
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" />

This successfully removed those permissions from the final merged manifest.

However, this is the first time I am submitting something built with Unity 2022 to the Meta platform, and I am finding that those permissions are not getting removed from the final AndroidManifest.xml file.

In addition to these permissions, I have found that, even though my Project Settings specify Install Location as Automatic (under Project Settings > Player > Other Settings > Configuration), and my custom manifest includes android:installLocation="auto", the merged manifest features android:installLocation="2", thus prompting another error on the Meta platform.

Are these problems with the manifest merging process a bug? Has the build process changed how this works on Unity 2022? Is there anything else I need to do?

I really need to get this sorted out, so any help is appreciated.
Thanks!

Hi, I have the same problem, previously (last year) it worked, but the current Unity doesn't remove the user-permission.

For temporary solution, I added the lines to remove user permission in this file:
/Application/Unity/Hub/Editor/{Version}/PlaybackEngines/AndroidPlayer/Apk/UnityManifest.xml

Try to add the tools node remove in the UnityManifest.xml file (for temporary solution before the bug fixed):

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

android:theme=" @ /UnityThemeSelector">









Hi,

Also having this problem with 2022.2.15 and 2022.2.16 and your potential fix did not work.

How to troubleshoot build failures:

First, make a blank project with a single blank scene and prove that it builds successfully.

If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

Until you can build a blank project to the target platform, don't fiddle with anything else.

Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

Most often things that prevent building are third-party libraries such as Firebase.

Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

Android build not building:

Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

https://discussions.unity.com/t/887277

Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

https://discussions.unity.com/t/891017/7

Android Gradle errors and other related stuff:

https://discussions.unity.com/t/901712/2

Keep in mind using 2022 means "I want to be an unpaid test pilot" as of right now.

https://discussions.unity.com/t/909358/4