yairm210 / Unciv

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

Android crash on loading from custom location #3729

Closed jgonyea closed 3 years ago

jgonyea commented 3 years ago

Describe the bug Unciv Android (v3.13.8 installed from FDroid) crashes when attempting to load a game from a custom location. PC version does not crash while loading a custom location save file.

To Reproduce Steps to reproduce the behavior using a new file

  1. Start new game
  2. Save game (The Ottomans - 0 turns)
  3. Force close app to ensure Unciv is not running
  4. Move save from Android/data/com.unciv.app/files/savefiles/The Ottomans - 0 turns to Downloads folder
  5. Reopen game
  6. Attempt to load game from custom location
  7. Use Android file browser to select the game from the Downloads folder
  8. Open the game save

Steps to reproduce the behavior using an existing file:

  1. Download save file from internet to Downloads folder
  2. Repeat steps 5 - 8 above

Expected behavior Game save loads.

Observed behavior After attempting to load the game save from a custom location, the android app crashes immediately to my home screen.

Additional context If I move either the newly created save game save or the downloaded one to the Android/data/com.unciv.app/files/savefiles/ location, the file will load properly.

jgonyea commented 3 years ago

Some further context: OnePlus 8T Android 11 (Technically Oxygen OS 11)

Using a save that has more turns than 0 behaves the same.

SomeTroglodyte commented 3 years ago

Did you check file properties to check whether the "app" user (whose user-id is >=10000) has access to your moved/downloaded file? If not, does changing the file's group or owner to that modify the result? Anything interesting in the system log (F-Droid offers MatLog which I like for that task - use filters or clear-provoke crash-pause to find anything relevant)? See, my idea is this might depend on what the tool used to copy/move files actually does to the Linux permissions? Sorry that I haven't actually tried that environment - yet. forget this

SomeTroglodyte commented 3 years ago

Reproduces on the Q/x86_64 emulator, last unciv line in exception call stack is CameraStageBaseScreen.kt:44, error is "java.lang.IllegalArgumentException: Error compiling shader"... and that line does indeed call SpriteBatch()

Full log:
04/16 18:42:47: Launching 'android' on FHD landscape API 30.
Install successfully finished in 781 ms.
$ adb shell am start -n "com.unciv.app/com.unciv.app.AndroidLauncher" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.unciv.app.test | com.unciv.app
Waiting for application to come online: com.unciv.app.test | com.unciv.app
Waiting for application to come online: com.unciv.app.test | com.unciv.app
Waiting for application to come online: com.unciv.app.test | com.unciv.app
Waiting for application to come online: com.unciv.app.test | com.unciv.app
Connecting to com.unciv.app
Connected to the target VM, address: 'localhost:42035', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/chatty: uid=10153(com.unciv.app) re-initialized> identical 5 lines
W/com.unciv.app: Accessing hidden field Landroid/app/ResourcesManager;->mLoadedApkAssets:Landroid/util/LruCache; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
W/com.unciv.app: Accessing hidden method Landroid/app/ResourcesManager;->countLiveReferences(Ljava/util/Collection;)I (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->countLiveReferences(Ljava/util/Collection;)I (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getAdjustedDisplay(ILandroid/content/res/Resources;)Landroid/view/Display; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/hardware/display/DisplayManagerGlobal;->getCompatibleDisplay(ILandroid/content/res/Resources;)Landroid/view/Display; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getConfiguration()Landroid/content/res/Configuration; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getDisplayMetrics()Landroid/util/DisplayMetrics; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/view/DisplayAdjustments;->DEFAULT_DISPLAY_ADJUSTMENTS:Landroid/view/DisplayAdjustments; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getDisplayMetrics(ILandroid/view/DisplayAdjustments;)Landroid/util/DisplayMetrics; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getDisplayMetrics(ILandroid/view/DisplayAdjustments;)Landroid/util/DisplayMetrics; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getAdjustedDisplay(ILandroid/view/DisplayAdjustments;)Landroid/view/Display; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getResources(Landroid/os/IBinder;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ILandroid/content/res/Configuration;Landroid/content/res/CompatibilityInfo;Ljava/lang/ClassLoader;Ljava/util/List;)Landroid/content/res/Resources; (blacklist, linking, denied)
    Accessing hidden method Landroid/content/res/ResourcesKey;->(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ILandroid/content/res/Configuration;Landroid/content/res/CompatibilityInfo;[Landroid/content/res/loader/ResourcesLoader;)V (blacklist, linking, denied)
I/chatty: uid=10153(com.unciv.app) re-initialized> identical 1 line
W/com.unciv.app: Accessing hidden method Landroid/content/res/ResourcesKey;->(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ILandroid/content/res/Configuration;Landroid/content/res/CompatibilityInfo;[Landroid/content/res/loader/ResourcesLoader;)V (blacklist, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->invalidatePath(Ljava/lang/String;)V (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/content/res/ResourcesKey;->isPathReferenced(Ljava/lang/String;)Z (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager$ApkKey;->path:Ljava/lang/String; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/content/res/ApkAssets;->close()V (blacklist, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager$ApkKey;->path:Ljava/lang/String; (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/content/res/ApkAssets;->close()V (blacklist, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->isSameResourcesOverrideConfig(Landroid/os/IBinder;Landroid/content/res/Configuration;)Z (greylist-max-o, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->overrideConfig:Landroid/content/res/Configuration; (greylist-max-o, linking, denied)
I/chatty: uid=10153(com.unciv.app) re-initialized> identical 1 line
W/com.unciv.app: Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->overrideConfig:Landroid/content/res/Configuration; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/content/res/Configuration;->diffPublicOnly(Landroid/content/res/Configuration;)I (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->overrideTokenDisplayAdjustments(Landroid/os/IBinder;Ljava/util/function/Consumer;)Z (blacklist, linking, denied)
    Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->activityResources:Ljava/util/ArrayList; (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/content/res/Resources;->overrideDisplayAdjustments(Ljava/util/function/Consumer;)V (blacklist, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->updateResourcesForActivity(Landroid/os/IBinder;Landroid/content/res/Configuration;IZ)V (greylist-max-o, linking, denied)
    Accessing hidden method Landroid/app/ResourcesManager;->getOrCreateActivityResourcesStructLocked(Landroid/os/IBinder;)Landroid/app/ResourcesManager$ActivityResources; (greylist-max-o, linking, denied)
I/studio.deploy: Finished instrumenting
W/ActivityThread: Application com.unciv.app is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
W/System: A resource failed to call close. 
W/System: A resource failed to call close. 
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/chatty: uid=10153(com.unciv.app) identical 7 lines
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1358)
D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/TetheringManager: registerTetheringEventCallback:com.unciv.app
D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib64/egl/libGLESv2_emulation.so
D/HostConnection: HostConnection::get() New Host Connection established 0x7a7b3817ba90, tid 10500
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
I/AndroidInput: sensor listener setup
D/HostConnection: HostConnection::get() New Host Connection established 0x7a7b38179510, tid 10527
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0x7a7b281a34f0: maj 3 min 0 rcv 3
D/EGL_emulation: eglMakeCurrent: 0x7a7b281a34f0: ver 3 0 (tinfo 0x7a7ac840c4d0) (first time)
D/HostConnection: HostConnection::get() New Host Connection established 0x7a7b3817c510, tid 10531
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
W/GL2JNIView: creating OpenGL ES 2.0 context
I/Gralloc4: mapper 4.x is not supported
D/EGL_emulation: eglCreateContext: 0x7a7b281a2cb0: maj 3 min 0 rcv 3
W/GL2JNIView: Returning a GLES 2 context
D/HostConnection: createUnique: call
    HostConnection::get() New Host Connection established 0x7a7b381795d0, tid 10527
D/goldfish-address-space: allocate: Ask for block of size 0x100
    allocate: ioctl allocate returned offset 0x3fba57000 size 0x2000
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
D/EGL_emulation: eglMakeCurrent: 0x7a7b281a2cb0: ver 3 0 (tinfo 0x7a7ac8412920) (first time)
I/AndroidGraphics: OGL renderer: Android Emulator OpenGL ES Translator (Mesa Intel(R) UHD Graphics (CML GT2))
I/AndroidGraphics: OGL vendor: Google (Intel)
    OGL version: OpenGL ES 3.0 (4.6 (Core Profile) Mesa 21.2.0-devel (git-55fb941 2021-04-16 focal-oibaf-ppa))
I/AndroidGraphics: OGL extensions: GL_EXT_debug_marker GL_EXT_robustness GL_OES_EGL_sync GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_shader_framebuffer_fetch GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
    framebuffer: (8, 8, 8, 0)
    depthbuffer: (24)
I/AndroidGraphics: stencilbuffer: (8)
    samples: (0)
    coverage sampling: (false)
I/AndroidGraphics: Managed meshes/app: { }
    Managed textures/app: { }
    Managed cubemap/app: { }
I/AndroidGraphics: Managed shaders/app: { }
I/AndroidGraphics: Managed buffers/app: { }
W/com.unciv.app: JNI critical lock held for 123.563ms on Thread[24,tid=10531,Runnable,Thread*=0x7a7c181b2e40,peer=0x12e67680,"GLThread 7971"]
W/com.unciv.app: JNI critical lock held for 20.251ms on Thread[24,tid=10531,Runnable,Thread*=0x7a7c181b2e40,peer=0x12e67680,"GLThread 7971"]
W/com.unciv.app: JNI critical lock held for 109.868ms on Thread[24,tid=10531,Runnable,Thread*=0x7a7c181b2e40,peer=0x133c0028,"GLThread 7971"]
W/com.unciv.app: JNI critical lock held for 80.704ms on Thread[24,tid=10531,Runnable,Thread*=0x7a7c181b2e40,peer=0x133c0028,"GLThread 7971"]
I/com.unciv.app: JIT allocated 50KB for compiled code of com.badlogic.gdx.utils.JsonValue com.badlogic.gdx.utils.JsonReader.parse(char[], int, int)
I/System.out: Loading ruleset - 1109ms
I/System.out: Loading ruleset - 16ms
    Mod loaded successfully: 5Hex Tileset
I/System.out: Loading percent complete of languages - 4ms
I/System.out: Natural Wonders for this game: [Rock of Gibraltar]
W/SoundPool: play soundID 1 not READY
D/CCodec: allocate(c2.android.mp3.decoder)
I/Codec2Client: Available Codec2 services: "software"
I/CCodec: Created component [c2.android.mp3.decoder]
D/CCodecConfig: read media type: audio/mpeg
D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater: extent() != 1 for single value type: output.subscribed-indices.values
    extent() != 1 for single value type: input.buffers.allocator-ids.values
    extent() != 1 for single value type: output.buffers.allocator-ids.values
    extent() != 1 for single value type: algo.buffers.allocator-ids.values
    extent() != 1 for single value type: output.buffers.pool-ids.values
    extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig: query failed after returning 7 values (BAD_INDEX)
D/CCodecConfig: c2 config diff is Dict {
      c2::u32 coded.bitrate.value = 64000
      c2::u32 input.buffers.max-size.value = 8192
      c2::u32 input.delay.value = 0
      string input.media-type.value = "audio/mpeg"
      string output.media-type.value = "audio/raw"
      c2::u32 raw.channel-count.value = 2
      c2::u32 raw.sample-rate.value = 44100
    }
D/CCodec: [c2.android.mp3.decoder] buffers are bound to CCodec for this session
D/CCodecConfig: no c2 equivalents for durationUs
    no c2 equivalents for track-id
    no c2 equivalents for encoder-delay
    no c2 equivalents for encoder-padding
    no c2 equivalents for flags
D/CCodecConfig: c2 config diff is   c2::u32 raw.channel-count.value = 1
W/Codec2Client: query -- param skipped: index = 1107298332.
D/CCodec: setup formats input: AMessage(what = 0x00000000) = {
      int32_t channel-count = 1
      int32_t max-input-size = 8192
      string mime = "audio/mpeg"
      int32_t sample-rate = 44100
    } and output: AMessage(what = 0x00000000) = {
      int32_t channel-count = 1
      string mime = "audio/raw"
      int32_t sample-rate = 44100
      int32_t encoder-delay = 576
      int32_t encoder-padding = 576
    }
W/Codec2Client: query -- param skipped: index = 1342179345.
    query -- param skipped: index = 2415921170.
E/FMQ: grantorIdx must be less than 3
E/FMQ: grantorIdx must be less than 3
D/CCodecBufferChannel: [c2.android.mp3.decoder#938] Created input block pool with allocatorID 16 => poolID 17 - OK (0)
I/CCodecBufferChannel: [c2.android.mp3.decoder#938] Created output block pool with allocatorID 16 => poolID 41 - OK
D/CCodecBufferChannel: [c2.android.mp3.decoder#938] Configured output block pool ids 41 => OK
E/ion: ioctl c0044901 failed with code -1: Inappropriate ioctl for device
E/FMQ: grantorIdx must be less than 3
E/FMQ: grantorIdx must be less than 3
D/CCodecBufferChannel: [c2.android.mp3.decoder#938] MediaCodec discarded an unknown buffer
I/chatty: uid=10153(com.unciv.app) NDK MediaCodec_ identical 1 line
D/CCodecBufferChannel: [c2.android.mp3.decoder#938] MediaCodec discarded an unknown buffer
I/hw-BpHwBinder: onLastStrongRef automatically unlinking death recipients
I/AndroidInput: sensor listener tear down
D/AudioTrack: createTrack_l(0): AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 9216
I/AndroidGraphics: paused
D/BufferPoolAccessor2.0: bufferpool2 0x7a7b881ab9c8 : 0(0 size) total buffers - 0(0 size) used buffers - 0/5 (recycle/alloc) - 4/18 (fetch/transfer)
D/BufferPoolAccessor2.0: evictor expired: 1, evicted: 1
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.unciv.app, PID: 10500
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { dat=content://com.android.externalstorage.documents/document/primary:Download/Aztecs -  0 turns flg=0x43 }} to activity {com.unciv.app/com.unciv.app.AndroidLauncher}: java.lang.IllegalArgumentException: Error compiling shader: 
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5015)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.IllegalArgumentException: Error compiling shader: 
        at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:164)
        at com.badlogic.gdx.graphics.g2d.SpriteBatch.(SpriteBatch.java:127)
        at com.badlogic.gdx.graphics.g2d.SpriteBatch.(SpriteBatch.java:81)
        at com.unciv.ui.utils.CameraStageBaseScreen.(CameraStageBaseScreen.kt:44)
        at com.unciv.ui.worldscreen.WorldScreen.(WorldScreen.kt:44)
        at com.unciv.UncivGame.loadGame(UncivGame.kt:140)
        at com.unciv.ui.saves.LoadGameScreen$getRightSideTable$2$1.invoke(LoadGameScreen.kt:99)
        at com.unciv.ui.saves.LoadGameScreen$getRightSideTable$2$1.invoke(LoadGameScreen.kt:23)
        at com.unciv.logic.GameSaver$loadGameFromCustomLocation$1.invoke(GameSaver.kt:72)
        at com.unciv.logic.GameSaver$loadGameFromCustomLocation$1.invoke(GameSaver.kt:13)
        at com.unciv.app.CustomSaveLocationHelperAndroid$loadGame$$inlined$synchronized$lambda$1.invoke(CustomSaveLocationHelperAndroid.kt:105)
        at com.unciv.app.CustomSaveLocationHelperAndroid$loadGame$$inlined$synchronized$lambda$1.invoke(CustomSaveLocationHelperAndroid.kt:17)
        at com.unciv.app.CustomSaveLocationHelperAndroid.handleIntentData(CustomSaveLocationHelperAndroid.kt:68)
        at com.unciv.app.AndroidLauncher.onActivityResult(AndroidLauncher.kt:86)
        at android.app.Activity.dispatchActivityResult(Activity.java:8310)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5008)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056) 
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7656) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
I/Process: Sending signal. PID: 10500 SIG: 9
Disconnected from the target VM, address: 'localhost:42035', transport: 'socket'

So the (libGdx) call SpriteBatch.createDefaultShader() succeeds normally, but fails in the activity response for the file selector "load from custom"? So that "call to OpenGL ES API with no current context" message must be relevant.

... I think I have the solution. Test code loads a custom location game successfully on the emulator.

SomeTroglodyte commented 3 years ago

@wbrawner : methinks this is your code (#3160)... I essentially added Gdx.app.postRunnable {...} around game.loadGame(gameInfo) in loadFromCustomLocation.onClick in LoadGameScreen.kt.

Want to test+PR this yourself? I'd be more comfortable as this was a lucky guess and I do not really have in depth understanding of the framework, so my testing might have missed something. Also, I tested after having modified a lot of peripheral stuff, e.g. removed all the structural differences between loading and saving in CustomSaveLocationHelperAndroid.kt, so that's another reason my testing might not be bulletproof. Lastly, did no regression tests on Android P N or M...