yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.26k stars 1.55k forks source link

Game crash on starting new game after deleting mod #11506

Closed Muro81 closed 4 months ago

Muro81 commented 4 months ago

Is there an existing issue for this?

Game Version

4.11.5

Describe the bug

I deleted ancient total war mod, which I didnt use at all. When I go to create new game I get a crash report. The last selected play option was a mod Fantasia that worked fine. Crash report: Platform: Android Version: 4.11.5 (Build 988) Rulesets: [Civ V - Vanilla, RekMOD, Civ V - Gods & Kings, DeCiv Redux, Epic of Fantasy, Barbarian xp farm, Civ6 Tileset, Fantasia] Last Screen: com.unciv.ui.screens.mainmenuscreen.MainMenuScreen


Device Model: M2101K6G API Level: 33 System Memory: 5570 MB Available (used by Kernel): 1995 MB System Low Memory state: false Java heap limit: 512 MB Java heap free: 19 MB


Message:

kotlin.UninitializedPropertyAccessException: lateinit property baseRuleset has not been initialized
    at com.unciv.ui.screens.newgamescreen.ModCheckboxTable.deselectIncompatibleMods(ModCheckboxTable.kt:199)
    at com.unciv.ui.screens.newgamescreen.ModCheckboxTable.updateSelection(ModCheckboxTable.kt:79)
    at com.unciv.ui.screens.newgamescreen.GameOptionsTable.update(GameOptionsTable.kt:77)
    at com.unciv.ui.screens.newgamescreen.GameOptionsTable.<init>(GameOptionsTable.kt:70)
    at com.unciv.ui.screens.newgamescreen.NewGameScreen.<init>(NewGameScreen.kt:77)
    at com.unciv.ui.screens.newgamescreen.NewGameScreen.<init>(NewGameScreen.kt:50)
    at com.unciv.ui.screens.mainmenuscreen.MainMenuScreen$newGameButton$1.invoke(MainMenuScreen.kt:150)
    at com.unciv.ui.screens.mainmenuscreen.MainMenuScreen$newGameButton$1.invoke(MainMenuScreen.kt:149)
    at com.unciv.ui.screens.mainmenuscreen.MainMenuScreen$getMenuButton$1.invoke(MainMenuScreen.kt:103)
    at com.unciv.ui.screens.mainmenuscreen.MainMenuScreen$getMenuButton$1.invoke(MainMenuScreen.kt:101)
    at com.unciv.ui.components.input.ActivationActionMap.activate(ActivationActionMap.kt:56)
    at com.unciv.ui.components.input.ActorAttachments.activate(ActorAttachments.kt:42)
    at com.unciv.ui.components.input.ActivationExtensionsKt.activate(ActivationExtensions.kt:17)
    at com.unciv.ui.components.input.ActivationListener.tap(ActivationListener.kt:15)
    at com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener$1.tap(ActorGestureListener.java:52)
    at com.badlogic.gdx.input.GestureDetector.touchUp(GestureDetector.java:206)
    at com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener.handle(ActorGestureListener.java:125)
    at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:354)
    at com.unciv.ui.screens.basescreen.UncivStage.access$touchUp$s80204510(UncivStage.kt:17)
    at com.unciv.ui.screens.basescreen.UncivStage$touchUp$1.invoke(UncivStage.kt:87)
    at com.unciv.ui.screens.basescreen.UncivStage$touchUp$1.invoke(UncivStage.kt:87)
    at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandling$1.invoke(CrashHandlingExtensions.kt:17)
    at com.unciv.ui.screens.basescreen.UncivStage.touchUp(UncivStage.kt:87)
    at com.badlogic.gdx.backends.android.DefaultAndroidInput.processEvents(DefaultAndroidInput.java:423)
    at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:503)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1590)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)

Able to provide any additional info needed.

Steps to Reproduce

  1. Install ancient total war mod.
  2. Don't use it.
  3. Also have fantasia installed.
  4. Make new game of Fantasia mod.
  5. Delete ancient total war.
  6. Go to new game
  7. Crash

Screenshots

No response

Link to save file

No response

Operating System

Android

Additional Information

No response

Muro81 commented 4 months ago

Deleting the map that was in the mod, solved it.

SomeTroglodyte commented 4 months ago

Deleting the map that was in the mod, solved it.

What? How do you delete a mod without also deleting its maps?

Muro81 commented 4 months ago

Not sure, I pressed from mods menu delete mod. And I go to maps editor screen, load map, and delete the map that was leftover. Should the game handle this scenario or the modders?

SomeTroglodyte commented 4 months ago

From the trace, clear enough.

But you must have re-saved the map in map editor before mod deletion, which makes a copy in your maps folder, otherwise it would have been gone. Must be. Better check myself...

SomeTroglodyte commented 4 months ago

Or - wait - one mod comes with maps that require another mod - could be - I've already thought about preventing that sort of thing... We'll see.

Muro81 commented 4 months ago

I never touched the map in map editor tho, only time i viewed it was in the star game screen.

SomeTroglodyte commented 4 months ago

... or Android bungled the delete. That OS's file security concepts are degrading more rapidly than butter on the surface of the sun... You don't happen to have a root file manager or adb-based one?

Waaaiiittt.... What was up with that perverse copying of the entire mods folder structure on startup? That could be the culprit of the map still being around!

That fix PR is valid anyway, but someone should investigate how all internal/local/external folders really look after mod deletion... And I am lazy.

Muro81 commented 4 months ago

Not sure about the file manager, I have one that came with phone.

SomeTroglodyte commented 4 months ago

Not sure about the file manager, I have one that came with phone.

Sorry, I was using too technical language. You can't normally see files private to an app except via how that app presents them. And I'd like to see what really became of the folder of a deleted mod. People with not-out-of-the-box tools could go and look, but normally you can't. And those tools are either a "rooted" OS (meaning you must have unlocked the device's loader partitions - either through a vendor feature or hacking) or a programmer's debugger.

On desktop, your steps do not reproduce any problem - which is fine as the patch closes a mistake that needed closing anyway.

Muro81 commented 4 months ago

Ive got android studio, could probably look up the files and folders created if you want me to.

SomeTroglodyte commented 4 months ago

android studio

"Device Explorer", then look for mod remnants (of the ancient thingy mod) under /data/data/com.unciv.app/files/mods and /sdcard/Android/data/com.unciv.app/files/mods ...

Muro81 commented 4 months ago

Yeah device explorer, but in like an hour or two.

Muro81 commented 4 months ago

I tried this but I cant access any files under the com.unciv.app, run as: package not debuggable, Is what it says.

SomeTroglodyte commented 4 months ago

Oh well, adb is a science in itself. Maybe it needs some more config, like activating developer mode and then some setting in the dev options... So gotta test that myself, only I got no API level 33 device or AVD in sight... Too resource-hungry and -wasteful...

Muro81 commented 4 months ago

Its possible to view debuggable aps, but id need to build it in debug mode on my phone to view that. Should it be possible if I git clone the project?

SomeTroglodyte commented 4 months ago

Remotely possible - though if so, it's likely a security feature comparing signatures. My Studio can look into all the apps's /data/data/packagename/files, no matter whether built myself or not, but then I have LineageOS and LOS may change these rules. adb bypassing Linux owner/group permissions always sounded to me like a feature marshalled by the system, not using the root hack to make the su binaries available...

Muro81 commented 4 months ago

Wel I have some apps that were built by myself on Windows machines. I can acces the debug ones but not the release ones that were signed? Or it could be the shrinking or minifying of resources as well I guess?

AdityaMH commented 4 months ago

Also editing base ruleset even just add "a" will lead you permanent crash.

SomeTroglodyte commented 4 months ago

No, just tested - mod deletion is clean, and the offer to copy mods from /sdcard/Android/data/com.unciv.app/files/mods is just that - an offer to be able to mod on Android, it only copies in one direction, no download leftover loaded from there. So that fix just merged should be enough... Tested, it does uncrash what was crashing.

SomeTroglodyte commented 4 months ago

... what the patch didn't fix is this: Start a new game with a base ruleset mod, then delete it, then try "Quickstart". No crash and the message is perfectly clear, but it could revert to vanilla instead - with message.... No priority.