How do i override android:icon tags in application node in android manifest

I have a make some android icons but its blurry.

The first answer here says that a mipmap icon is better.

So i renamed the app icons folders to mipmap instead of drawable.
But now i can’t change the android manifest android:icon tags in application node.

How can i override it?

Thanks.

This is how I solved this for Unreal Engine 5.1:

I used Unreal Plugin Language (UPL) to edit the AndroidManifest.xml at build time. To figure this out myself, I mostly followed this article; specifically the section “Using a Round Icon”.

To summarize: create a .xml file next to your Build.cs file (often at Source/{Project}/{Project}.Build.cs). I named mine AddAdaptiveIcon_UPL.xml. The contents should look something like this:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
	<!-- init section is always evaluated once per architecture -->
	<init>
	</init>

	<androidManifestUpdates>
		<!-- remove existing android:icon attribute -->
		<removeAttribute tag="application" name="android:icon"/>
		<!-- add desired android:icon attribute -->
		<addAttribute tag="application" name="android:icon" value="@mipmap/ic_launcher"/>
	</androidManifestUpdates>
</root>

Of course, my icon xml file is called ic_launcher.xml and is in Build/Android/res/mipmap-anydpi-v26/, but edit your UPL script to point to yours.

Then, once you’ve done this, you need to tell unreal engine to actually run your UPL script. To do this, add the following lines to your Build.cs file:

if (Target.Platform == UnrealTargetPlatform.Android)
{
    // Add UPL to add configrules.txt to our APK
    string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
    AdditionalPropertiesForReceipt.Add("AndroidPlugin", System.IO.Path.Combine(PluginPath, "AddAdaptiveIcon_UPL.xml"));
}

I should add, I copied these lines for Build.cs from the article I posted above and don’t know the nuances of how it works, especially the pathing stuff. It worked the first time and now I’m afraid to touch it =)

Anyway, now when you build and package your android project, it should work like you expect.

3 Likes

This reply saved me so much time and worked perfectly. Thank you so much!

1 Like

Thanks a lot for sharing this!