-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Step 0: Are you in the right place?
[REQUIRED] Step 1: Describe your environment
- Unity version: 2020.29.f1
- Google Mobile Ads Unity plugin version: 8.8.0
- Platform: Android
- Platform OS version: Android 11 (eg iOS 10, Android 9)
- Any specific devices issue occurs on: _____
- Mediation ad networks used, and their versions: _____
[REQUIRED] Step 2: Describe the problem
Calling this during startup (to register app stage change events for OnOpen ads):
AppStateEventNotifier.AppStateChanged += OnAppStateChanged;
Results in the following exception:
2023-04-12 11:44:43.679 13474-13538/? E/Unity: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/DefaultLifecycleObserver;
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/DefaultLifecycleObserver;
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: androidx.lifecycle.DefaultLifecycleObserver
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) [0x00000] in <00000
Steps to reproduce:
- Try to execute the following code: AppStateEventNotifier.AppStateChanged += OnAppStateChanged;
It looks like an important dependency may have been removed in commit 598e82e:
598e82e
Adding these lines back into the GoogleMobileAdDependencies.xml file fixes this for me:
https://maven.google.com/ https://maven.google.com/Relevant Code:
See above