UE 4.27.2 - How to build for target SDK 33 (or 34) !

As you guys might have also got the notice that new apps must target sdk 33.

I had been banging my head since the past 6 hours playing with gradle versions, aapt2, etc to no avail.

Finally found a viable solution! :slight_smile: Steps:

1. In The SDK Manager:

Install API 33 (you can have others as well, but this is important):

Install build tools 30.0.3 (don’t install any version higher than this, UE4 uses the latest installed version !):

Install ndk 21.4.7075529:

install command line tools 11 (latest for now):

2. In The Unreal Engine Settings:

Make sure to set all 3 of these exactly the same. I am using jdk8 (aka 1.8) which comes default shipped with Android Studio 4.0.0. It is also recommended to use this exact version of studio in the official 4.27 docs. I have not test a higher java version than 8 so I wouldn’t recommend it:

2. Modify an engine file:

Edit WebViewControl.java in:

[YOUR UNREAL ENGINE INSTALL DIRECTORY]\Engine\Build\Android\Java\src\com\epicgames\ue4\WebViewControl.java

comment out (or remove) these 3 lines:

viewer.getSettings().setAppCacheMaxSize(1024*1024*8);   
viewer.getSettings().setAppCachePath("/data/data/com.your.package.appname/cache"‌​);    
viewer.getSettings().setAppCacheEnabled(true);

3. last but not least

Delete these folders:

C:\Users\[YOUR_USERNAME]\.gradle
[YOUR_PROJECT_DIRECTORY]\DerivedDataCache
[YOUR_PROJECT_DIRECTORY]\Intermediate
[YOUR_PROJECT_DIRECTORY]\Saved

Restart engine and build ! :smiley:

5 Likes

Just tested with Target Version 34, it works ! :smiley:

Keep everything the same (including compile version 33), just change the target version to 34.

Note: It is recommended and advised that the compile version is not set lower than the target version. But I’m glad it works fine for this version on my project.

1 Like

Make sure to also add:

android:exported=“true”

to your GameActivity node like this:

Otherwise you might get this error while uploading to playstore:

You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set.

You can also manually add this tag in the manifest through an editor like android studio after the build, useful in case a old plugin which you don’t have access to isn’t using this tag.

2 Likes

If this works, it would be amazing!!! im going to test this out over the next few days and get back to you. Should this work with engine version 4.26? Also, would the save files/storage permissions work? Thanks!

Haven’t tested with 4.26 but works perfect for 4.27.2.

Although I haven’t mentioned this in the post, but you might not want to have anything higher than version 8.0 installed for ‘Android SDK Command line Tools’ since it was recently causing problems for me in Unreal Engine 5. This might not cause any issues on UE4 but just in case.

Sorry, I don’t quite understand what you mean by ‘files/storage permissions’. Are you talking about the 'MANAGE_EXTERNAL_STORAGE' manifest permission that is often required to deploy directly on android device without issues ? Then yes, this shouldn’t make any difference. Just try.

is this work with the new version of android studio? (hedgehog version)

Thank you for the instructions. Was looking of doing this as well. Worked like a charm. Wonderful thing this Community :slight_smile:

1 Like

I did everything in this content after that i can build my game but when i want to run on my Android device; i can’t install the APK file? I’m using UE4

For those who set targetsdk to 34 and face this error (my UE version 4.26.1): Android Gradle build error “AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon.”

Checkout the solution here : Android Gradle build error "AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon." - Stack Overflow

To link with sdk34, you actually need to compile with sdk 33 (Not sure if its a bug or not)

You should modify UEDeployAndroid.cs to make string CompileSDKVersion = “33”, either this hard coded way. Or make a new ini in Default Engine.ini [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] to set this a compile skd version, and read it in C# code.

I could packaged the APK-file according to your instructions. But now I have a problem to install this APK on my device :sweat_smile:, neither via Batch-File install, nor manually from Device Storage. When I try to install any of packages, I receive these errors:

Windows Batch File


Manual installation

My packaging settings:



Device developer-mode settings:


(Android 13)

From the adb error, it seems like one or more of your activities/services or broadcast receivers declared in the manifest file are using intent filters and have not explicitly defined the tag android:exported="true". Since you are on android 13, this could certainly be the issue.

If this is the case, I have already provided the solution for this above