Saving and loading problem on android only

I’m using this save system in my game:

https://forums.unrealengine.com/filedata/fetch?id=1525798

I have this system in 3 blueprints in my game scene which are going to be saving/loading data somewhere during run time.
They’re always on the “Event begin play” and “Event Construct” nodes.

When I need to save a value I use:

https://forums.unrealengine.com/filedata/fetch?id=1525799

When I need to load a value I use:

https://forums.unrealengine.com/filedata/fetch?id=1525800

and It works fine… In editor and development builds.

Now in shipping builds it’s a whole different story.

First of all I have it it so the game is in one apk file and I have the “Use ExternalFilesDir for UE4Game Files” Option unchecked since
I found it to be very prone to exploitation from the player, I also wanted the saves to be persistent through uninstalls.
I added the following permissions to the “Extra Permissions” Section of the Advanced APK Packaging menu:
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_INTERNAL_STORAGE
android.permission.READ_INTERNAL_STORAGE

I also added the to the android manifest manually just in case.

If I build my APK as a development build, everything works fine, the APK asks for external storage permission on installation and the saving and loading work fine.
When I try building my APK for distribution though the APK does not as for any permission and the saving and loading don’t work, I then go inside the app permissions in my phone’s settings menu and manually grant the game storage permission which makes the menu scene able to “sometimes” save and load a value or two, however the game scene is still unable to save/load anything.

I’ve been pulling my hair out on this issue for a while, testing it on multiple devices and trying a bunch of different solutions that proved fruitless such as trying the “Use ExternalFilesDir for UE4Game Files” option.

at the moment I’m at my wit’s end and don’t have a clue where to go from here, without this feature I really don’t have a game, so any help you can provide my with is very very much appreciated.

Thanks in advance.

Don’t know if it’s the full picture, but since the latest android patch, my device is not granting “storage” permissions to the game when installed from the PC. But you can go to “App Info” on the device and grant it manually, now my game is saving again. I wonder if it’ll have this issue when installed from the Google Play. hope not.

I though it was 4.21, but it seems is not an issue on UE4 side. but on how Android treats Apps installed from wherever.

I will +1 this too. The exact same issue is occuring with me too. The version is 4.19. When packing for distribution after putting my keystore file, the save system simply stops. When not packaging for distribution, it works fine.

In my case only when “Use ExternalFilesDir” is checked the save system works.

Hi did you had a chance to test on the “Google Play” side if it is working without extra permissions?

as per 4.21, the save slot file is in the PrivateStorage of the app so it should not required extra permissions.
I opened a case on this. I will update here if I have a feedback.

As of today, I had to put the ExternalFileDir option to true in order to not block my development process, but I won’t publish my game with this option set to true

Thanks!

This is not true.
I had a long talk with support of EPIC and they do confirm that we must check ExternalFileDir to have the file save in the ApplicationStorage. The name of the option is confusing, but as per our conversation that was validated by Epix Tech staff, this option allow in 4.21 to save the file at the right place. All those confusing stuff is linked to changed in API of google.

thanks

This issue is happening because the game has no Certificate. Unlike Development Build Version of the game, when installing the Shipping Build Android thinks it’s a harmful app thus denies any permission by default (Without asking you). That’s why you have to manually set permission in your Android Device.

If you create and install a certificate for your game or upload and download the game from Google Play Store the game will work just fine as expected.

Hope this helps!!! :smiley:

Thanks for this “Precious Info”. This was a huge issue for publishing a game, I’m glad it’s Solved.

I’m still having the same problem, nothings seems to help and I’m really stumped… I removed any extra permissions and checked the ExternalFileDir option, uploaded to google play and downloaded to my test device… and I’m still having the same problem.
Thank you all for trying to help, Maybe UE4 is just not the right answer for android games.

Which android version are you using? Actually I was having the same problem but it was solved just by checking “ExternalFileDir” option and it worked perfectly fine. I am using UE 4.19.2

Can you please check some stuffs just to be sure -

  1. After installing and playing for the first time if UE4Game folder is being created in the root folder of your Phone Memory or is it getting created inside Android → Data → com.xxx.xxx
  2. Connections between Levels and related GameMode Blueprints of your game
  3. Using LoadGameFromSlot Node while Loading a value
  4. Default Maps and Modes in Project Settings
  5. Try Other Devce
  6. Try migrating into a new Project

I’m sending you my project’s setting feel free to give it a shot if it can help you

  1. Project Settings → Project → Packaging : link text

  2. Project Settings → Platforms → Android : link text

Rename them on change the extension from .txt to .ini

I’m on android 8.1.0, the UE4Game folder is nowhere to be found, it’s not on the root of the phone memory neither is it inside the game’s folder in Data… all levels have the same GameMode blueprint, I’m using the LoadGameFromSlotNode to load values, my main menu map and loading screen map are in their respective places in the default maps and modes section, I tried the game on an emulator as well as on some friends’ devices unfortunately I’m still getting the same result, I have ExternalFileDir checked and I even do a check on the main menu scene’s level blueprint to check if I have external write permission and if I don’t it’s supposed to request it…

when I install the game it doesn’t ask for any permissions what so ever it says “the app doesn’t require any special permission” and when I go into settings - permission - storage it’s storage permission is set to off, when I go into the game it still doesn’t ask me to give permission and even if I set the permission manually from the settings menu the same still doesn’t work, I tried migrating the project before but for no avail… I have a whole game ready and it’s ruined by this weird bug…

PS: if I try to build for windows saving and loading values work perfectly fine which is even more weird…

Naturally If you use “ExternalDir” option the game doesn’t ask any permission but still saves the game inside Android → Data → com.xxx.xxx → UE4Game.

Thanks for the informations. By the looks of it try :

  1. Using the setting files I attached (Override some basic info like name,versions etc)
  2. Recheck CreateSaveGameSlot node and DoesSaveGameExists Node
  3. Try using Different Game Modes for Each Levels
  4. If the problem still persists you always can contact Epic Officials through Mail.

oh yeah and one more thing, try rechecking and debug nodes like “PrintString” Just to be safe.
Thanks!

I’m having the same problem, when using ExternalFileDir it works normally, if unchek stops working, how did you make it work without ExternalFileDir?