Reproduction steps:
1. Open the attached “ASDQWE” project
2. Open the Build Settings Window (File > Build Settings)
3. Check the “Export” checkmark and export the project
4. Open the exported project with Android Studio
5. To the <project>/unityLibrary/src/main/java/UnityPlayerGameActivity.java (or UnityPlayerActivity.java) file make these changes:
5.1. Add new imports:
import android.annotation.TargetApi;
import android.window.OnBackInvokedCallback;
5.2 Add a new class to the same file:
// Make this extend either Activity or GameActivity, to match the Unity activity
class CustomActivity extends GameActivity {
@TargetApi(33)
protected OnBackInvokedCallback getOnBackInvokedCallback()
{ return null; }
}
5.3 Make the UnityPlayerGameActivity (UnityPlayerActivity) extend the new class
6. In the Android Studio, press the “Build” button to launch the app
7. Observe the Player
Expected result: The Player does not freeze
Actual result: The Player freezes and “AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/window/OnBackInvokedCallback” is logged
Reproducible with: 6000.0.15f1
Could not test with: 2021.3.42f1, 2022.3.42f1 (Could not downgrade the project due to compilation errors)
Reproducible environment: MacOS Sonoma 14.5 (Intel), Windows 10 (user’s)
Not reproducible environment: No other environment tested
Reproducible with these devices:
VLNQA00175, Samsung Galaxy Note9 (SM-N960F), Android 10, CPU: Exynos 9 (9810), GPU: Mali-G72
VLNQA00519, Google Pixel 4 (Pixel 4), Android 12, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00372, Samsung SM-G991U (SM-G991U), Android 12, CPU: Snapdragon 888, GPU: Adreno (TM) 660
Not reproducible with these devices:
VLNQA00547 - samsung Galaxy Tab A8 (SM-X200), CPU: Unisoc Tiger T618, GPU: Mali-G52, OS: 13
VLNQA00591 - samsung Galaxy S23 (SM-S911B), CPU: Snapdragon 8 Gen 2 (SM8550), GPU: Adreno 740, OS: 14
Could not test with these devices::
VLNQA00057, Htc One M9+ (HTC_M9pw), Android 6.0, CPU: MediaTek Helio X10 MT6795T, GPU: PowerVR Rogue G6200
VLNQA00146, Htc 10 (HTC 10), Android 8.0.0, CPU: Snapdragon 820 MSM8996, GPU: Adreno (TM) 530
(The API requirements are not met)