Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error AOA , phone hang #3483

Open
hoangnnq opened this issue Jul 26, 2024 · 6 comments
Open

Error AOA , phone hang #3483

hoangnnq opened this issue Jul 26, 2024 · 6 comments
Assignees

Comments

@hoangnnq
Copy link

hoangnnq commented Jul 26, 2024

[REQUIRED] Step 1: Describe your environment

  • Unity version: 2022.3.38f1
  • Google Mobile Ads Unity plugin version: 8.6.0 or 9.0.0 or 9.2.0
  • Plugin installation method: unity package or clone this github (Unity package manager, .unitypackage import)
  • Platform: Build Android on Unity
  • Any specific devices issue occurs on: many phones android(android 11, android 12)
  • Mediation ad networks used, and their versions: MAX or Ironsource or demo on this github

[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

 private void OnAppStateChanged(AppState state)
        {
            Debug.Log("App State changed to : " + state);

            // If the app is Foregrounded and the ad is available, show it.
            if (state == AppState.Foreground)
            {
                Debug.LogError("Showad");
                ShowAd();
            }
        }
@NVentimiglia
Copy link
Member

@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.

@NVentimiglia NVentimiglia self-assigned this Aug 1, 2024
@hoangnnq
Copy link
Author

hoangnnq commented Aug 5, 2024

Please let me know whether to replace or add to androidPackages section in GoogleMobileAdsDependency.xml?
image

@hoangnnq
Copy link
Author

hoangnnq commented Aug 6, 2024

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

@saravanansam2997
Copy link

same issue

@NVentimiglia
Copy link
Member

Please let me know whether to replace or add to androidPackages section in GoogleMobileAdsDependency.xml? image

Please add these dependencies to the existing file.

@hoangnnq
Copy link
Author

hoangnnq commented Oct 2, 2024

I added and it shows as logcat as shown above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants