Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save game on Android 14 #12892

Closed
1 task done
knolleCC opened this issue Feb 1, 2025 · 2 comments
Closed
1 task done

Cannot save game on Android 14 #12892

knolleCC opened this issue Feb 1, 2025 · 2 comments
Labels

Comments

@knolleCC
Copy link

knolleCC commented Feb 1, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Game Version

4.15.4

Describe the bug

After switching to my new Phone with Android 14, Unciv cannot load or save files from/to the usual folder in android/data.
Saving in game fails saying "Could not save game".
My old games are not displayed in load dialog.
When I "return to main menu" the auto save produces the attached Exception.
I guess it has something to do with changed storage access in Android 14.

Steps to Reproduce

Start new game and try to save, see above comment.

Screenshots

No response

Link to save file

No response

Operating System

Android

Additional Information

Platform: Android
Version: 4.15.4 (Build 1,093)
Rulesets: [Civ V - Vanilla, Civ V - Gods & Kings]
Last Screen: com.unciv.ui.screens.mainmenuscreen.MainMenuScreen


Device Model: SHIFTphone 8
API Level: 34
System Memory: 10318 MB
Available (used by Kernel): 4190 MB
System Low Memory state: false
Java heap limit: 512 MB
Java heap free: 65 MB


Message:

com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: SaveFiles/Autosave (External)
	at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:386)
	at com.unciv.logic.files.UncivFiles.saveGame(UncivFiles.kt:172)
	at com.unciv.logic.files.UncivFiles.saveGame(UncivFiles.kt:161)
	at com.unciv.logic.files.UncivFiles.saveGame$default(UncivFiles.kt:159)
	at com.unciv.logic.files.Autosaves.autoSave(UncivFiles.kt:476)
	at com.unciv.logic.files.Autosaves$requestAutoSaveUnCloned$job$1.invokeSuspend(UncivFiles.kt:465)
	at com.unciv.logic.files.Autosaves$requestAutoSaveUnCloned$job$1.invoke(Unknown Source:8)
	at com.unciv.logic.files.Autosaves$requestAutoSaveUnCloned$job$1.invoke(Unknown Source:4)
	at com.unciv.utils.ConcurrencyKt$launchCrashHandling$1.invokeSuspend(Concurrency.kt:89)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at com.unciv.utils.Dispatchers$CrashHandlingDispatcher$dispatch$1.invoke(Concurrency.kt:190)
	at com.unciv.utils.Dispatchers$CrashHandlingDispatcher$dispatch$1.invoke(Concurrency.kt:190)
	at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandling$1.invoke(CrashHandlingExtensions.kt:17)
	at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandlingUnit$1.invoke(CrashHandlingExtensions.kt:33)
	at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandlingUnit$1.invoke(CrashHandlingExtensions.kt:33)
	at com.unciv.utils.Dispatchers$CrashHandlingDispatcher.dispatch$lambda$0(Concurrency.kt:190)
	at com.unciv.utils.Dispatchers$CrashHandlingDispatcher.$r8$lambda$L3K1aau81hhVdGYYei_E7yWI2wU(Unknown Source:0)
	at com.unciv.utils.Dispatchers$CrashHandlingDispatcher$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
	at java.lang.Thread.run(Thread.java:1012)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: SaveFiles/Autosave (External)
	at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:363)
	at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:383)
	... 21 more
Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.unciv.app/files/SaveFiles/Autosave: open failed: EACCES (Permission denied)
	at libcore.io.IoBridge.open(IoBridge.java:574)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:259)
	at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:355)
	... 22 more
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
	at libcore.io.Linux.open(Native Method)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8109)
	at libcore.io.IoBridge.open(IoBridge.java:560)
	... 24 more

Save Mods:

[Civ V - Gods & Kings]
``
@knolleCC knolleCC added the bug label Feb 1, 2025
@yairm210
Copy link
Owner

yairm210 commented Feb 1, 2025

I cannot make sense of this at all.
It's trying to write to the external storage folder belonging to Unciv so according to everything I read online Unciv should by default have permissions to write there
I can't find anything that states otherwise, I think we need a real Android dev to weigh in here :|

@knolleCC
Copy link
Author

knolleCC commented Feb 1, 2025

Ok, I deinstalled the app and deleted the data folder. After reinstall it works now... Something must have gone wrong when I restored my save games the first time, though i dont know what.

@yairm210 yairm210 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants