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

put the extra permissions in Build/Android ManifestRequirementsOverride.txt

This method worked for me. However it’s should be shipping build. Also Android File Server plugin turned Off.

Before packaging clear binaries,intermediate,DDC and build->Android ASTC/Multi Folder (Not Android folder)

2 Likes

.bat Method worked for me too I did not have to override.

What is .bat method? Would you show me a source about that method. I have also Storage permission problem?

Where is this file located?

ProjectName/Source/ProjectName/

AndroidSanitizePermissions_UPL.xml

You create this file. And tell the project to use it by modifying your build.cs, by adding within public:

        if (Target.Platform == UnrealTargetPlatform.Android)
        {
            string manifestFile = System.IO.Path.Combine(ModuleDirectory, "AndroidSanitizePermissions_UPL.xml");
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", manifestFile);
        }

Hi @LocoLeppy LocoLeppy, did you find a solution to this problem? I’m also stuck with this problem, trying to distribute the App via PlayStore for internal testing

Thanks, I was able to get save game writing to work following this.
(development build, UE5.3, target + min SDK set to 32, sideloading on to a Quest 2).

A couple details for anyone following the post at Anton Rassadin — Using scoped storage in debug Unreal Engine builds on Android API 29+ :

  • replace com.epicgames.ue4.GameActivity.bUseExternalFilesDir with com.epicgames.unreal.GameActivity.bUseExternalFilesDir for UE5

  • you’ll need to wrap the XML given at the bottom of the blog post in the following:

<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
  <androidManifestUpdates>
  ...
  </androidManifestUpdates>
</root>

Then save to ProjectName/Source/ProjectName/AndroidSanitizePermissions_UPL.xml

1 Like

Thank you Origins!

Manage to create a file in Documents on a Quest 3.
SDK 33, Shipping and Multi.
Didn’t have to desactivate Android File Server nor deleting any folders.

1 Like

Thank you! I’ve updated the post to reflect changed GameActivity fully qualified class name in Unreal Engine 5.

I appreciate your solution in that it worked perfectly without having to downgrade the Android API level from 33 to 32.

Here is another discussion regarding this topic

Thanks to Anton Rassadin’s help doc, @RealAero and @ericwa I was able to get saves working with Unreal 5.4.3 on the Meta Oculus Quest 3. Saves weren’t working for me after I’d upgraded to 5.4. I could not save save files on my quest. Here’s all the relevant settings I’m aware of, and how i’ve set them, hopefully this is helpful to see it all in one place.

Build: shipping or development
Android
APK Packaging
Minimum SDK Version 32
Target SDK Version 32
useExternalFilesDir: True

Advanced APK Packaging

Extra Permissions
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE

Launch Images
Show launch image: True

Android SDK settings:

I was getting this issue from MQDH meta quest developer hub / adb logs.:

java.lang.IllegalArgumentException: Primary directory UnrealGame not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]

Here’s the full log error:

18:17:16.873  2146 19214 E MediaProvider : java.lang.IllegalArgumentException: Primary directory UnrealGame not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:3370)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:3021)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:3780)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:4364)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.insert(MediaProvider.java:4064)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:8375)
18:17:16.873  2146 19214 E MediaProvider : at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:8470)
18:17:16.878  2146 10646 W MediaProvider : Forgot to handle a top level directory in getContentUriForFile?

I added one file, and edited another:
image

AndroidSanitizePermissions_UPL.xml:

<root xmlns:android="http://schemas.android.com/apk/res/android">
  <androidManifestUpdates>
	  <loopElements tag="meta-data">
	  <setStringFromAttribute  result="NameTagValue" tag="$" name="android:name"/>
	  <setBoolIsEqual result="UseExternalFilesDirElement" arg1="$S(NameTagValue)" arg2="com.epicgames.unreal.GameActivity.bUseExternalFilesDir"/>
	  <if condition="UseExternalFilesDirElement">
		<true>
		  <removeElement tag="$"/>
		</true>
	  </if>
	</loopElements>

	<addElements tag="application">
	<meta-data android:name="com.epicgames.unreal.GameActivity.bUseExternalFilesDir" android:value="true" />
	</addElements>
  </androidManifestUpdates>
</root>

Then create a link to this in your build script: *the project name in this case is NitroGrid

NitroGrid.Build.cs:

using UnrealBuildTool;

public class NitroGrid : ModuleRules
{
	public NitroGrid(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
		
		// Allow saves on android
		if (Target.Platform == UnrealTargetPlatform.Android)
        {
            string manifestFile = System.IO.Path.Combine(ModuleDirectory, "AndroidSanitizePermissions_UPL.xml");
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", manifestFile);
        }
	}
}

After making those changes, saving save objects worked great.

I did not need to request save permissions with this code, possibly because I installed via the .bat file generated with the APK file, which grants permissions. If you’d using a different install method, you may need to request permissions like this:

2 Likes

Put in on folder that you put the build, i called my folder “BUILD” and i put on my project, “my project folder”/BUILD/Android/ManifestRequirementsOverride.txt

i use on UE5.4, and i still on progress to solving this prob, i can override that xml and it changes, but still can not running on my android version 14, but running in android 12

1 Like

THE LEGEND ! <3

what about Obb file which is i dont want to realese it in playstore !

Finally! This worked for me. Only like the 300th solution I tried lol.