Permission requiired you must approve this premission in app settings:storage

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

15 Likes

Thank you very much for solution, but what if we use blueprints?

Hi Nire2020,

You can still use blueprints, but you have to change your project to C++ project.

Blueprints still work even when you change to C++ project.

Hi @zerg_queen,
Can you please provide which SDK, NDK you used to build your android game with Target API 33?

1 Like

Hi @RakibRahaman

It’s me zerg_queen (now using name YD Visual)

Currently I am on:
Unreal Engine 5.2.0
Android Studio version 4.0
SDK: Android SDK Platform 32
NDK: r25b (25.1.8937393)

Hi @zerg_queen (New Name YD Visual),

Thanks for your reply!

I have managed to build my game for API 33!
I am using UE 4.72.

@RakibRahaman - Thats great! Good work :slight_smile:

Thanks, what you suggested is working for me, but now i m facing an issue where the app is unable to obtain storage permission on Android 13, resulting in the inability to save my game files and causing the save system of my game to crash on Android 13. How can you resolve this?

3 Likes

Hi @whylessh -

Yes this appears to be yet another new problem with UE and Android 13.
Not sure what the fix will be yet - I will take a look at it sometime if Epic doesn’t fix it soon!

Enable this

Use ExternalFilesDir for UE4Game files?

As the tooltip says, this will remove the WRITE_EXTERNAL_STORAGE permission.

7 Likes

Hi.
Have you already solved it?
Can you tell me how to solve?
I use ue5.1

Hi.
I need you help.
I have tried your soloution,but it not work.
This is my question link:No permissions requested: Permission requiired you must approve this premission in app settings:storage

Thank you.

Final,I try again. It works.
Thanks

1 Like


I use that code in GameInstance Blueprint
I made a Paste Bin Blueprint

Can you please tell me how did you do it, stuck on this for days, set all sdk but in 12 it dont save and in android 13 its invalid package

I currently receiving this error when trying to launch the project.

“Build.cs(18,37) : error CS1001: Identifier expected”

Correct me if im wrong but apparently is a typo but everything look exactly the same as the video.

following you instructions now. On android 13 you are supposed to be able to save without permissions if you are saving in the same folder of the app (DEFAULT APP DATA) should be where the game is creating the savegameobject. Do you know of any method of doing that by now? It seems to be a bug with unreal engine were it creates a external storage location by default. Anyways thanks for bringing us this far

Unreal Engine tries to write directly to external storage in some conditions, which is not ideal on modern Android. To override this behavior, you need to add bUseExternalFilesDir=true meta-data element to AndroidManifest. I posted an example of possible solution in this post.

2 Likes

thank you so much… i was struggling with issue for more than week but that in vein…
this saves me from going back to older version and working again
Thanks a lot

I’ve been looking for a solution for a week, it worked, thank you very much.

1 Like