playstore console crashes: java.lang.NoSuchMethodError
Exception java.lang.NoSuchMethodError: No virtual method getParcelableExtra(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; in class Landroid/content/Intent; or its super classes (declaration of 'android.content.Intent' appears in /system/framework/framework.jar)
at org.mozilla.fenix.HomeActivity.handleNewIntent (HomeActivity.kt:10)
at org.mozilla.fenix.HomeActivity.onNewIntentInternal (HomeActivity.kt:6)
at org.mozilla.fenix.HomeActivity.onNewIntent (HomeActivity.kt:49)
at android.app.Activity.performNewIntent (Activity.java:8213)
at android.app.Instrumentation.callActivityOnNewIntent (Instrumentation.java:1409)
at android.app.Instrumentation.callActivityOnNewIntent (Instrumentation.java:1422)
at android.app.ActivityThread.deliverNewIntents (ActivityThread.java:4031)
at android.app.ActivityThread.handleNewIntent (ActivityThread.java:4043)
at android.app.servertransaction.NewIntentItem.execute (NewIntentItem.java:53)
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:2307)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8506)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1139)
TLD android and google bad, deprecared an API to forced us to upgrade but it only exists on newest android so is crashing everywhere else. Thankfully stack over flow has a gross solution and moz already are using it in getParcelableExtraCompat()
which, for posterity is
fun <T> Intent.getParcelableExtraCompat(name: String, clazz: Class<T>): T? {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
getParcelableExtra(name, clazz)
} else {
@Suppress("DEPRECATION")
getParcelableExtra(name) as? T?
}
}