Search Unity

Crash on android just invoked Advertisement.Initialize

Discussion in 'Unity Ads & User Acquisition' started by hbbalfred, Feb 8, 2019.

  1. hbbalfred

    hbbalfred

    Joined:
    Sep 30, 2016
    Posts:
    3
    Hi All,

    I have a problem that run the game in Android device.
    It still crashed when all of codes removed only left `Advertisement.Initialize(gameId, testMode)`
    so, I think it's not the callback issue.

    Here is my Env
    • OS macOS High Sierra 10.13.6
    • Unity Version 2018.3.0f2
    • Unity Advertisement Version 3.0.1 in Package Manager
    (It has the same result that use Unity Monetization 3.0.1 in Assets Store instead.)

    Code (JavaScript):
    1. #09  pc 00006d34   ( (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_LogException (System.Exception,UnityEngine.Object) {0xc016b1d8} + 0x44 (0xdca18cf0 0xdca18d84) [0xe5c53f00 - Unity Root Domain]+27956)
    2. #10  il 0000003b  at (wrapper managed-to-native) UnityEngine.DebugLogHandler.Internal_LogException (System.Exception,UnityEngine.Object) <0x0003b>
    3. #11  il 0000002b  at UnityEngine.DebugLogHandler.LogException (System.Exception,UnityEngine.Object) [0x00012] in <004fc436a9154f7fab4df9679445af6c>:0
    4. #12  il 0000004f  at UnityEngine.Logger.LogException (System.Exception,UnityEngine.Object) [0x00012] in <004fc436a9154f7fab4df9679445af6c>:0
    5. #13  il 00000037  at UnityEngine.Debug.LogException (System.Exception) [0x00006] in <004fc436a9154f7fab4df9679445af6c>:0
    6. #14  il 0000013f  at UnityEngine.Advertisements.Purchasing.Initialize (UnityEngine.Advertisements.IPurchasingEventSender) [0x00066] in <f004747a7d1f408394c8b1655deef535>:0
    7. #15  il 0000001f  at UnityEngine.Advertisements.Purchase.onInitializePurchasing () [0x00000] in <f004747a7d1f408394c8b1655deef535>:0
    8. #16  il 000000bb  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0x000bb>
    9. #17  il 00000043  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0x00043>
    10. #18  il 000000a3  at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00032] in <0000d56de0ae43ca875d7babfd990580>:0
    11. #19  il 00000047  at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in <0000d56de0ae43ca875d7babfd990580>:0
    12. #20  il 0000016b  at UnityEngine.AndroidJavaProxy.Invoke (string,object[]) [0x0005f] in <004fc436a9154f7fab4df9679445af6c>:0
    13. #21  il 0000013b  at UnityEngine.AndroidJavaProxy.Invoke (string,UnityEngine.AndroidJavaObject[]) [0x0004a] in <004fc436a9154f7fab4df9679445af6c>:0
    14. #22  il 000000ff  at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy,intptr,intptr) [0x00065] in <004fc436a9154f7fab4df9679445af6c>:0
    15. #23  il 0000008b  at (wrapper runtime-invoke) <Module>.runtime_invoke_intptr_object_intptr_intptr (object,intptr,intptr,intptr) <0x0008b>
    I check the crash log and found `UnityEngine.Advertisements.Purchasing.Initialize `
    then, I go to dashboard to re-setup the Placement, unlink the IAP Promotion from the video ad setting.
    The game no longer crash even if I link the IAP Promotion again in setting.

    That make me confusing.
     
    Heishi1989 likes this.
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    Thanks for bringing this up!

    Does the IAP promotion work without crashing now?
     
  3. hbbalfred

    hbbalfred

    Joined:
    Sep 30, 2016
    Posts:
    3
    May be not yet...
    In fact it also crashed after I set up IAP promotion in video placement again, although it not happened immediately. I guess there is a delay of network ?
    Now I have to remove the IAP promotion setting in order for no crashing.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    May I ask, why are you using a video for an IAP Promotion (In-App Purchase)? Does it work when you use an IAP product only?
     
  5. hbbalfred

    hbbalfred

    Joined:
    Sep 30, 2016
    Posts:
    3
    Actually I don't remember I have set up the IAP Promotion in the video placement...I've been running around like a headless chicken all day trying to solve the crash problem, finally as above i said that i found `Purchasing.Initialized` in log and i guess maybe something wrong in placement setting.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @hbbalfred Got it, something you'll want to check in your Dashboard.
     
  7. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    @hbbalfred
    The crash is happening because of the Crash Reporting Service.
    You have miss-configured a promo placement in Dashboard in this case the exception should be thrown, but there is a bug within the Engine right now, so instead of the managed exception, the player crashes.
    Here is a link to the original bug report:
    https://issuetracker.unity3d.com/is...is-enabled-but-sdk-is-not-included-in-a-build
    The bug is fixed in 19.2, also, the fix will be backported to 19.1 and 18.3 soon.
     
    Heishi1989 likes this.
  8. Heishi1989

    Heishi1989

    Joined:
    Nov 25, 2018
    Posts:
    6
    I have the same problem

    My game is crash when invoked Advertisement.Initialize

    I don't remember I have set up IAP Promotion in the video placement

    but when I go to the dashboard, IAP Promotion has been linked to the video ad

    unlink the IAP Promotion from the video ad setting.
    The game no longer crash

    Is this an Unity Ads error?
     
  9. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    This is the Engine bug. It will happen for all exceptions, even not related to IAP, but IAP miss-configuration is the most common reason for the managed exception.
    In order to confirm that this is the same issue. Make a development build (Inside Build Settings), and check the adb logs on a device. Try to find CRASHREPORT::CAPTUREMETADATA .
     
    Heishi1989 likes this.
  10. Smozon

    Smozon

    Joined:
    Mar 7, 2018
    Posts:
    2
    Any specs on when?
     
  11. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    Hello,
    I have checked it.
    Verified fixed in Version 2018.3.8f1 and Verified fixed in 2019.1.0b3.
     
  12. KnewK

    KnewK

    Joined:
    Sep 2, 2012
    Posts:
    19
    Hi, I have intermittent crash on Android when calling Advertisement.Initialize(gameId, testMode); in AR Foundation 2019.2.21. If I comment it out the game runs. If not I get black camera on initialization or crash of the game. Sometimes it comes through ok.
     
    Last edited: May 3, 2020
    GilbertoBitt likes this.
  13. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    111
    i also having this problem on 2019.3.12f1. using advertisement package 3.4.5
     
    KnewK likes this.
  14. KnewK

    KnewK

    Joined:
    Sep 2, 2012
    Posts:
    19
    Nice to know I'm not alone. I tried putting the Advertisement.Initialize(gameId, testMode) in an IEnumerator to delay the init for 1-2 seconds and also wrapped the initialize in a test for connection. It just delayed the crash by 2 seconds. Happening about 50% of the time. Have implemented the Appodeal api instead, for Android.
     
    GilbertoBitt likes this.
  15. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    111
    I did the same thing..
     
  16. dhwanit-z

    dhwanit-z

    Joined:
    Jun 20, 2020
    Posts:
    2
    Happening to me using Unity 2020.1.2f and Unity Ads 3.4.9?
     
  17. KnewK

    KnewK

    Joined:
    Sep 2, 2012
    Posts:
    19
    Run the android monitor while the android device is plugged into the USB. Android Logcat in the package manager or create and run a shortcut to Program Files\Unity\Hub\Editor\2020.1.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools monitor.bat and get some log info. We can then raise a new support ticket.
     
  18. KnewK

    KnewK

    Joined:
    Sep 2, 2012
    Posts:
    19
    I switched back to Unity ads for testing this but I haven't been able to reproduce the crash on either Pixel 2 or Moto G7 Plus (prev error on this device). Using 2019.4.7 with Ads 3.4.9. Tried upping to 2020.1.2 but too many errors to clean up.