Hello!
For a while now I’ve been struggling with the permissions for Android Development. I want to get rid of the permissions GET_ACCOUNTS and READ_PHONE_STATE, since they are the only ones that force me to make a privacy policy for the Google Play Store. I do not do anything with the information given, and are default under the Engine. But I have found no way to change the permissions.
The first method that I came across was adding ManifestRequirementsOverride.txt to the “[Project Name]\Intermediate\Android\APK” file in your project file. However, the text document would not get rid of GET_ACCOUNTS and READ_PHONE_STATE, nor anything else that I wanted it to. In short, it wouldn’t override anything. I have tried it on multiple projects, each with the same output: no change to the AndroidManifest.xml file.
This is the answerhub post that I found it in: Removing Android app permissions - Programming & Scripting - Epic Developer Community Forums
Here’s a screenshot of my file setup before packaging my project, you can see the requirements for both AndroidManifest.xml and ManifestRequirementsOverride.txt. Packaging reverts AndroidManifest.xml to its original state.
The second method that I found was editing UE4’s source code. Supposedly, going to “Epic_Games\UE_4.15\Engine\Source\Programs\UnrealBuildTool\Android\UEDeployAndroid.cs” and changing the section that generated the manifest file will change the way that the manifest file generates. This doesn’t work, for me at least. I deleted the two Text.AppendLine that added in GET_ACCOUNTS and READ_PHONE_STATE, to no avail. I edited them in Microsoft Visual Studio. The edits remain even after packaging the game.
I found this method at the forum post: Any way to edit the AndroidManifest.xml Manually? - Mobile - Epic Developer Community Forums
Here’s a screenshot of the section of code that I modified:
Hello ,
Thanks for replying! Unfortunately, deleting the Android file has no effect. It is the same as before. The UEDeployAndroid.cs file still shows the edits.
The easiest way to achieve this is to use UPL (“Unreal Plugin Language”) file to remove permissions. As I know, it’s not publicly documented, so you have to dig through UE4 source code to understand what it is capable of. Basically, UPL is an XML that allows to modify contents of Android- and iOS- specific files, such as AndroidManifest.xml or GameActivity.java.
Create RemoveAndroidPermissions_UPL.xml file near the .Build.cs file of your project. It should contain this:
UPL as above works, but the reason you had trouble with ManifestRequirementsOverride.txt is it should be in your project’s Build/Android folder. It will get copied to Intermediate/Android/APK but it doesn’t look for it there.
BTW, this won’t be necessary for these two permission in 4.16; we removed them as the old reason for needing them is not longer valid.
Hello Chris Babcock,
Thanks for replying to my forum post, I’m glad that Staff spend time on the forums/answerhub to help idiots like me. I’m also pleased that the two permissions will be removed in 4.16. I placed ManifestRequirementsOverride.txt in my project’s Build/Android folder, but unfortunately all that it did was cause the building to end in an “Exit Code = 5”. I’ll attach the output log for it if you’d like to look at it.
endragorr & : I have not tried the UPL method yet. I’ve tried a variation of it before, but after messing up the source code I CTRL+Z’d for ages out of a panic. I shall update soon to tell whether or not it works.
None of that worked for me.
I had to change AndroidManifest manually and use Gradle build bat to compile a new APK with changes. Only this way it works with Unreal Engine 5.3