When my Android game does an in-app update it fails to relaunch on some devices. Here's the logcat from two devices, one that succeeds and one that fails to relaunch.
Samsung S24 - successfully relaunches
------------------ PROCESS STARTED (1644) for package com.my.game ------------------
------------------ PROCESS ENDED (1644) for package com.my.game ------------------
------------------ PROCESS STARTED (2938) for package com.my.game ------------------
Pixel 8 Pro - Fails to relaunch
------------------ PROCESS STARTED (10208) for package com.my.game ------------------
------------------ PROCESS ENDED (10208) for package com.my.game ------------------
Relevant lines from my build.gradle.
compileSdk 35
minSdkVersion 31
targetSdkVersion 35
multiDexEnabled true
implementation 'com.google.android.play:app-update:2.1.0'
implementation 'com.google.android.play:app-update-ktx:2.1.0'
This is how I initiate the app update flow.
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
appUpdateManager.startUpdateFlowForResult(appUpdateInfo, activityResultLauncher,
AppUpdateOptions.newBuilder(AppUpdateType.IMMEDIATE).build())
Steps to reproduce.
- Install current version of app from play store
- Publish new version of app to play store
- App prompts for in-app update
- Accept and begin update
- Update downloads
- Update installs
- App fails to relaunch after the install
- Phone returns to the Home Screen
Expected behavior: App should relaunch after the install.
NOTE: User can immediately relaunch the game from the Home Screen and it runs just fine. The crash only occurs when play services tries to launch the new version of the game.
I can't debug with Log or printf because none of my code gets executed, so I've been trying different ways to build my app, etc. The one clue I've found is that I can get rid of this problem by completely removing my "game.so" shared native library from the APK. If I leave the "game.so" in the APK but never reference it or call it, the crash still occurs.
This leads me to theorize there's some static initializer in my "game.so" or one of its dependencies. I don't see anything in logcat that would help lead me to the source of the problem, but maybe I just don't know what to look for?
What could be causing this problem and how do I fix it?