Open hoangnnq opened 4 months ago
@hoangnnq
Update GoogleMobileAdsDependencies.xml with the following
<androidPackage spec="androidx.lifecycle:lifecycle-common-java8:2.4.1">
<repositories>
<repository>https://maven.google.com/</repository>
</repositories>
</androidPackage>
<androidPackage spec="androidx.lifecycle:lifecycle-process:2.4.1">
<repositories>
<repository>https://maven.google.com/</repository>
</repositories>
</androidPackage>
If that does not work, respond with the logcat.
Please let me know whether to replace or add to androidPackages section in GoogleMobileAdsDependency.xml?
I added it and still get the error here is the logcat:
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : App State changed to : Foreground←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.Logger:Log (UnityEngine.LogType,object)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.Debug:Log (object)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : GoogleMobileAds.Sample.AppOpenAdController:OnAppStateChanged (GoogleMobileAds.Common.AppState) (at D:/Unity/Project/Admod/HelloWorld/Assets/Scripts/AppOpenAdController.cs:149)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : GoogleMobileAds.Android.AppStateEventClient:onAppStateChanged (bool)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : System.Reflection.MethodBase:Invoke (object,object[])←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.AndroidJavaProxy:Invoke (string,object[]) (at /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJava.cs:174)←[0m
←[38;5;40m08-06 16:53:22.470 7730 7730 I Unity : UnityEngine.AndroidJavaProxy:Invoke (string,UnityEngine.AndroidJavaObject[]) (at /home/bokk←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : Showad←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.Logger:Log (UnityEngine.LogType,object)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.Debug:LogError (object)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : GoogleMobileAds.Sample.AppOpenAdController:OnAppStateChanged (GoogleMobileAds.Common.AppState) (at D:/Unity/Project/Admod/HelloWorld/Assets/Scripts/AppOpenAdController.cs:154)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : GoogleMobileAds.Android.AppStateEventClient:onAppStateChanged (bool)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : System.Reflection.MethodBase:Invoke (object,object[])←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.AndroidJavaProxy:Invoke (string,object[]) (at /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJava.cs:174)←[0m
←[38;5;196m08-06 16:53:22.471 7730 7730 E Unity : UnityEngine.AndroidJavaProxy:Invoke (string,UnityEngine.AndroidJavaObject[]) (at /home/bokken/build/output/unity/←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : Showing app open ad.←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : UnityEngine.Logger:Log (UnityEngine.LogType,object)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : UnityEngine.Debug:Log (object)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : GoogleMobileAds.Sample.AppOpenAdController:ShowAd () (at D:/Unity/Project/Admod/HelloWorld/Assets/Scripts/AppOpenAdController.cs:107)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : GoogleMobileAds.Sample.AppOpenAdController:OnAppStateChanged (GoogleMobileAds.Common.AppState) (at D:/Unity/Project/Admod/HelloWorld/Assets/Scripts/AppOpenAdController.cs:155)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : GoogleMobileAds.Android.AppStateEventClient:onAppStateChanged (bool)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : System.Reflection.MethodBase:Invoke (object,object[])←[0m
←[38;5;40m08-06 16:53:22.473 7730 7730 I Unity : UnityEngine.AndroidJavaProxy:Invoke (string,object[]) (at /home/bokken/build/output/unity/unity/Modules/A←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : UnityException: SetActive can only be called from the main thread.←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : Constructors and field initializers will be executed from the loading thread when loading a scene.←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : at (wrapper managed-to-native) UnityEngine.GameObject.SetActive(UnityEngine.GameObject,bool)←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : at GoogleMobileAds.Sample.AppOpenAdController.ShowAd () [0x00055] in D:\Unity\Project\Admod\HelloWorld\Assets\Scripts\AppOpenAdController.cs:116 ←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : at GoogleMobileAds.Sample.AppOpenAdController.OnAppStateChanged (GoogleMobileAds.Common.AppState state) [0x00032] in D:\Unity\Project\Admod\HelloWorld\Assets\Scripts\AppOpenAdController.cs:155 ←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : at GoogleMobileAds.Android.AppStateEventClient.onAppStateChanged (System.Boolean isBackground) [0x0000b] in <11fcca18a58a44b6b7e50228671e7a7e>:0 ←[0m
←[38;5;196m08-06 16:53:22.503 7730 7730 E Unity : at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],Sys←[0m
←[38;5;40m08-06 16:53:22.505 7730 7730 I Unity : onResume←[0m
←[38;5;75m08-06 16:53:22.560 7730 7785 D Unity : SetWindow 0 0xc9305008←[0m
←[38;5;75m08-06 16:53:22.562 7730 7785 D Unity : SetWindow 0 0xc9305008←[0m
←[38;5;166m08-06 16:53:22.637 1742 2003 W ActivityManager: setHasOverlayUi called on unknown pid: 9115←[0m
←[38;5;166m08-06 16:53:22.641 1742 1796 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;166m08-06 16:53:22.641 1742 1796 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;40m08-06 16:53:22.675 7730 7730 I Unity : onPause←[0m
←[38;5;40m08-06 16:53:22.705 1742 2095 I ActivityManager: Start proc 9298:com.qualcomm.telephony/u0a231 for service {com.qualcomm.atfwd/com.qualcomm.atfwd.AtFwdService} caller=com.qualcomm.atfwd←[0m
←[38;5;166m08-06 16:53:22.762 1742 8894 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;166m08-06 16:53:22.762 1742 8894 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;166m08-06 16:53:23.012 1742 1796 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;166m08-06 16:53:23.013 1742 1796 W ActivityManager: Sending non-protected broadcast com.android.systemui.fullscreen.statechange from system 2377:com.android.systemui/1000 pkg com.android.systemui. Callers=←[0m
←[38;5;40m08-06 16:53:23.106 1742 2919 I ActivityManager: Killing 9225:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:1/u0a712i244 (adj 0): isolated not needed←[0m
←[38;5;40m08-06 16:53:27.869 1742 2095 I ActivityManager: Start proc 9337:com.google.android.apps.messaging/u0a211 for content provider {com.google.android.apps.messaging/com.google.android.apps.messaging.shared.datamodel.provider.sharedstorage.SharedStorageProvider} caller=com.google.android.ims←[0m
I tested on this github demo
same issue
Please let me know whether to replace or add to androidPackages section in GoogleMobileAdsDependency.xml?
Please add these dependencies to the existing file.
I added and it shows as logcat as shown above
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
Exit and re-enter multiple times to let App Open ad run the OnAppStateChanged function -> it run onPause but not run onResume -> phone hang