Some week ago I noticed crashes in Crashlytics:
Fatal Exception: java.lang.IllegalArgumentException: Activity client record must not be null to execute transaction item
at android.app.servertransaction.ActivityTransactionItem.getActivityClientRecord(ActivityTransactionItem.java:85)
at android.app.servertransaction.ActivityTransactionItem.getActivityClientRecord(ActivityTransactionItem.java:58)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:43)
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:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Seems it occurs on app start but 100% on Android 12 and 95% on samsung (75% samsung Galaxy A51) devices. I checked on A51 but for me it works fine and I can't reproduce the issue. Maybe someone already solved this issue or has some insight into what or where could be something wrong? Thanks!
Looks like this is a bug in Android 12 that has been fixed, but not rolled out fully yet. Ref:https://issuetracker.google.com/issues/210886009
You can workaround this issue by bypassing the splash screen APIs on Android 12 as show below:
class MyActivity : AppCompatActivity() {
private var splashScreen: SplashScreen? = null
private val shouldAvoidSplashScreen = Build.VERSION.SDK_INT == Build.VERSION_CODES.S ||
Build.VERSION.SDK_INT == Build.VERSION_CODES.S_V2
private var dismissSplash = false
override fun onCreate(savedInstanceState: Bundle?) {
if (shouldAvoidSplashScreen) setTheme(R.style.Theme_MyApp) else {
splashScreen = installSplashScreen()
}
super.onCreate(savedInstanceState)
if (shouldAvoidSplashScreen.not()) splashScreen?.run {
setKeepOnScreenCondition { !dismissSplash }
}
setContent { ... }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With