Save game not work on Android sdk version 30

Hey, can you please tell me the project settings required for this solution to work? I’m having a hard time understanding all the steps that are needed for the solution since this thread has solutions that don’t seem to work. So if you could please mention all the things that are needed to resolve this, that would be really helpful.
Thank you.
P.S.- FYI, I just edited the SaveGameSystem.h file without doing any other previously mentioned solutions and it didn’t work, hence my request.

Hello,

I forgot this part in my first answer. However I don’t think it will solve your issue because it would cause Android package not to compile if that would be the case.

#pragma once

...

#ifdef USE_ANDROID_FILE 
#include "Android/AndroidPlatform.h"
#endif

/**
 * Interface for platform feature modules
 */
...

We have a game on Google Play and it works fine with the answer I gave. However, I had issues with the same code snippet I have posted here, but after updating Unreal Engine repo everything worked correctly. That may be your case too.

The commit I checked out and make it work is this one:

The settings I have used for our published game is as follows:



I hope these will fix your issue.

Hey, thanks for the reply. It actually started working when I packaged my game for as universal apk. I have no idea why that is but it just worked.

1 Like

Hi, I am following the same steps but cannot seem to save. Do you have any tips? Does this look OK?

Hi, I am following the same steps but cannot seem to save. Do you have any tips? Does this look OK?

Is this meant to work with the UE4 Slot system?

I am currently using UGameplayStatics::AsyncSaveGameToSlot and UGameplayStatics::SaveGameToSlot.

Can I just simply replace the slot name with the saveDir that you return from this function? The slot typically doesn’t have the .sav extension as they add that manually, but I also don’t know where this slot defaults to. I assume that this directory you swap to might not be correct with slot usage.

Hello Chris.

Sorry for the late response.

I use this solution with UGameplayStatics::SaveGameToSlot, and it works just fine.

My code is something like this:

	if (URR_SaveGame* saveGameInstance = Cast<UXX_SaveGame>(UGameplayStatics::CreateSaveGameObject(UXX_SaveGame::StaticClass())))
	{
		saveGameInstance->playerName = m_playerName;
		saveGameInstance->highScore = m_highScore;

		check(UGameplayStatics::SaveGameToSlot(saveGameInstance, SAVE_SLOT, saveGameInstance->userIndex) != false);
	}

Actually this solution must work for all save-to-file operations since it only returns where to save your USaveGame data file. Since UGameplayStatics::AsyncSaveGameToSlot and UGameplayStatics::SaveGameToSlot works with the same subsystem except for doing it async or not by calling GetSaveGamePath(Name) function at the end.

1 Like

Ahh very nice. Thank you! And you didn’t take a while to get back to me at all!

So you use the saveDir that you get our of GetSaveGamePath and use that as your SAVE_SLOT? that sounds pretty good to me if that’s the case. Thank you for your help with this!