[Flutter 3.22] AR crashes on Android < 13 - NoClassDefFoundError: Landroid/window/OnBackInvokedCallback #957
Labels
android
This issue is specific to the Android Platform.
bug
This issue refers to a bug in the plugin
Flutter issue/bug
Problem caused by Flutte that we can't fix
Unity issue/bug
Problem caused by Unity that we can't fix on our end.
Description
Since Flutter 3.22, Unity will crash on certain Android versions when ARFoundation is activated.
This only happens on Android <13.
This might also affect other unity plugins using native code, I just noticed it using ARFoundation.
Unity works fine for 3D scenes but crashes when I switch to a scene that includes ARFoundation and its ARSession.
Error in the console:
(unity 2022.3)
(unity 2023.2)
More info
Looking up OnBackInvokedCallback, it is added in API 33 (android 13) and is related to the predictive back gesture in Android 14.
I narrowed it down to this commit on Flutter master, which includes the engine PR Platform channel for predictive back in route transitions on android.
Any Flutter master commit before this one won't crash.
I can also reproduce this with the flutter_embed_unity plugin. So it isn't specific to code in this plugin.
Flutter version
Crashed on:
Did not crash on:
Unity version
Only tested with:
2022.3.21f1, 2022.3.33f1, 2023.2.20f1.
ArFoundation 5.1.2, 5.1.4 and 5.1.5
Android devices
Devices without crash:
Devices with crash:
Some things I've tried
-keep class android.window.** { *; }
-keep class android.window.OnBackInvokedCallback { *; }
.android:enableOnBackInvokedCallback="false"
to all androidmanifest activities and applications.implementation "androidx.activity:activity:1.6.0
in gradle(OnbackInvokedCallback is mentioned in the changes.)
The text was updated successfully, but these errors were encountered: