Hi all,
This problem happens with targetSdkVersion=33 on Android 13(API33).
The cause is due to the way API33 handles the WRITE_EXTERNAL_STORAGE permission.
Unreal Engine android app permission logic works something like this:
In the splash screen(launch image) activity:
1 App checks for any un-granted permissions
2 App sends a request to user to grant those permissions
3 App waits until user approves permission(s)
4 App receives a message from Android system indicating user has approved the permission(s)
5 When all permissions are granted, the splash screen activity starts the actual game.
In API33, if a request for WRITE_EXTERNAL_STORAGE permission is requested:
The Android system AUTOMATICALLY returns a message saying the request/permission was denied.
Also, it is not possible see or grant WRITE_EXTERNAL_STORAGE.
Long story short, this is actually the expected and correct behavior for API33.
In fact, from API33 WRITE_EXTERNAL_STORAGE has no meaning and can be ignored completely.
So, the UE app will never get past the splash screen activity.
Note:
By disabling the splash screen (uncheck âShow launch imageâ in UE project settings) will skip all permission checking and start the game (as noted by user Fe_Games_Studio), but this is not a good solution since it skips permission checks and doesnât look as professional without a splash screen.
Changing targetSdkVersion=32 also works, but Google Play will soon require all new apps to support targetSdkVersion=33 by August 2023.
The most robust solution to this problem is to change the AndroidManifest.xml:
From:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
To:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
This means when this app is installed on an Android device with an API higher than 18 (ie API33) the WRITE_EXTERNAL_STORAGE permission will be ignored as if it wasnât even in the AndroidManifest.xml file.
Note:
Instead of maxSdkVersion=â18â, you could also choose â23â or even â32â
Read up about WRITE_EXTERNAL_STORAGE and how it is used on different API levels for more info
But for basic UE apps, â18â should be fine.
Now since you canât directly change the AndroidManifest.xml by hand anymore in UE, you must use UPL(Unreal Plugin Language). Itâs worth learning the basics of UPL since you may need it again to do this sort of thing.
Watch this good UPL tutorial on YouTube:
For the UPL xml file use this:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
<androidManifestUpdates>
<removePermission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<addPermission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
</androidManifestUpdates>
</root>
This will remove WRITE_EXTERNAL_STORAGE and add it back with the maxSdkVersion attribute.
Now package your app and check the APK AndroidManifest.xml.
You should now have the app starting after the splash screen(launch image)
Notes:
Iâm currently working with Unreal Engine 5.2.0
To see the code for permissions logic in the splash screen: after a build look in:
PROJECT_NAME/Intermediate/Android/arm64/src/com/epicgames/unreal/SplashActivity.java