[Android] "Extra Tags for node" adds attributes, not tags

I’m trying to add a < supports-screens > tag as a child of < manifest > in the generated AndroidManifest.xml file.

There is a field called “Extra Tags for < manifest >`` node” that sounds like it should do this, but it actually adds attributes (i.e. attribute="value" pairs) to the node, not tags.

Trying to add a tag in this section results in malformed XML like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="false" android:xlargeScreens="true"/>

Aside from the fact that this field should be renamed to “Extra attributes for < manifest > node” and a new field “Child nodes/tags for < manifest > node” should be created, is there any way for me to add extra child nodes to the < manifest > node?

Epic, can I get a response on this?

If anyone is interested in how to get extra actual tags (not attributes) under the < manifest > node, you can actually hack the “Extra permissions” section to inject XML. Just add a valid permission (I chose READ_EXTERNAL_STORAGE), then add a double quote and closing tag "/> to complete the permission node, then add your XML, then leave off your last double quote and closing tag "/> as that will be added by Unreal.

The text I added in one of the “Extra permissions” slots was:

android.permission.READ_EXTERNAL_STORAGE"/> <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" android:requiresSmallestWidthDp="600

Massive hack, but this was the only way I could find to add things like < supports-screens > tags.

I’m surprised there hasn’t been any answer to this. What is the preferred method as I’m trying to add the following (to support tablets)

<supports-screens android:largeScreens="true" android:xlargeScreens="true" />

This bug sucks. Fortunately there is APL (Android Plugin Language), wich can be used to modify manifest (and more).

You should confrim that in 4.10 (I confirm, but without details now) and repost it in Bug Reports category. It will helps others and might be fixed in 4.11

Put a file named ManifestRequirementsOverride.txt in the [YOUR GAME]/Build/Android folder as described at Removing Android app permissions - Programming & Scripting - Epic Developer Community Forums
This is apparently a temporary solution.

Everything inside ManifestRequirementsOverride.txt gets put inside the manifest tag.
Note that this replaces any existing requirements.
As of 4.11 the requirements are:

<!-- Entery your SDK versions here as required -->
<uses-sdk android:minSdkVersion=\"21\" android:targetSdkVersion=\"21\"/>
<uses-feature android:glEsVersion=\"0x00020000"\" android:required=\"true\" />  <!-- or 0x00030000 -->
<uses-permission android:name=\"android.permission.INTERNET\"/>
<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>
<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>"
<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>"
<uses-permission android:name=\"com.android.vending.CHECK_LICENSE\"/>"
<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>"
<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>"
<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>"
<uses-permission android:name=\"android.permission.VIBRATE\"/>"
<!-- and billing if used -->
<uses-permission android:name=\"com.android.vending.BILLING\"/>

The more technically inclined might want to look at the C# code in UnrealEngine\Engine\Source\Programs\UnrealBuildTool\Android\UEDeployAndroid.cs (around line 1923 in the GenerateManifest function).

Bumping. This is still a problem, and so far there is no official word on the matter. Causing us real headaches at the moment!

Additionally, there are duplicate keys being generated in the manifest which means debugging Android is literally impossible right now. I’m following this guide: http://zompi.pl/unreal-engine-4-debugging-on-android/

Did you read the workaround I posted in a comment to the original question?

Did you read the workaround I posted in a comment to the original question?

I did, but don’t fully understand how you did it. I’m looking at the packaging settings in the Project Settings, not seeing where you’ve added what you did.

Irritating that we can’t just edit the XML directly :confused:

Additionally, it doesn’t work anymore. I was able to install it on a phone despite adding the tags you put above.

The < supports-screens > tag only comes into effect on the Play store - you can still deploy to a phone manually.

The hack works by injecting your XML into the “Extra Permissions” section rather than using the “Extra tags for application node” section.

When you add a permission, the XML generator generates < uses-permission android:name=", then inserts the permission you specified, then closes the tag by adding " /> to the end. What the hack does is prematurely closes the uses-permission tag, then adds your XML (which is missing the final quotation mark and closing tag), then lets the generator add " />, resulting in valid XML.

The generated XML looks like this, and appears below the rest of the uses-permission tags:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true" android:requiresSmallestWidthDp="600" />

Did you used my solution? It’s powerfull method, which might solve yours any other needs.

You’re right, this does seem to work.

Horrible hack though :frowning: Man this needs fixing.

Just use APL and you can modify any node you want using platform dependent variables

You can also use ManifestRequirementsAdditions.txt which just adds to the requirements without requiring the full section be replaced like with ManifestRequirementsOverride.txt.

Good tip, thanks Chris :slight_smile: