Search Unity

Google IMA SDK for iOS / Android

Discussion in 'Unity Ads & User Acquisition' started by DubzP3, Mar 13, 2019.

  1. DubzP3

    DubzP3

    Joined:
    May 1, 2017
    Posts:
    1
    I'm working on an app that integrates ads from Google Ad Manager (formerly DFP) using Googles AdMob plugin. For banners this is fine and works great but the client has requested we use the Google IMA SDK for pre-roll video ads before and after gameplay to keep in line with their other natively developed apps. I haven't found anything along the lines of a plugin to allow the use of the IMA SDK in Unity. Was hoping someone here may know how to interact with it. Any help is much appreciated.
     
    55pixels likes this.
  2. andpuent

    andpuent

    Joined:
    Mar 2, 2022
    Posts:
    2
    I'm currently integrating the IMA sdk on a wrapper that is used later by Unity. Unluckily after all initialization of the IMA sdk i'm getting following crash.

    Code (Boo):
    1. --------- beginning of crash
    2. 10-05 12:09:25.259  2547  2547 E AndroidRuntime: FATAL EXCEPTION: main
    3. 10-05 12:09:25.259  2547  2547 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/tasks/TaskCompletionSource;
    4. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.google.ads.interactivemedia.v3.internal.ajq.<init>(IMASDK:8)
    5. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.google.ads.interactivemedia.v3.internal.aij.<init>(IMASDK:1)
    6. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:6)
    7. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:4)
    8. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.VAST.NexIMAWrapper$3.run(NexIMAWrapper.java:484)
    9. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:938)
    10. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99)
    11. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at android.os.Looper.loop(Looper.java:246)
    12. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:8429)
    13. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
    14. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
    15. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
    16. 10-05 12:09:25.259  2547  2547 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.tasks.TaskCompletionSource
    17. 10-05 12:09:25.259  2547  2547 E AndroidRuntime:     ... 12 more
    18. 10-05 12:09:25.261  1087 11212 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
    19. 10-05 12:09:25.262  1087  4843 D Debug   : low && ship && 3rdparty app crash, do not dump
    20. 10-05 12:09:25.262  1087  4843 W ActivityManager: crash : com.10807
    21. 10-05 12:09:25.262  1087  4843 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1162 com.android.server.am.AppErrors.crashApplicationInner:578
    Does any1 have any hints to solve this? Basically the crash is happening here.

    //------------- java code ------------
    new Handler(context.getMainLooper()).post(new Runnable() {
    @override
    public void run() {
    Log.i("on UI thread");
    mAdsLoader = mSdkFactory.createAdsLoader(context, imaSdkSettings, adDisplayContainer);

    mAdsLoader.addAdErrorListener(instance);
    mAdsLoader.addAdsLoadedListener(instance);
    }
    });
    //------------- end java code ------------

    I already solve this problem once. Before i got this error (NoClassDefFoundError) with a different class when initializing the IMA sdk, i solved it by adding the .jar file on Plugins/Android on Unity project.

    But this crash error is from internal android classes, so i'm not sure how can i solve it.

    I've already tried:
    • Upgrading sdk & ndk android versions.
    • Using unity versions 2020, 2021 & 2022 with latest android sdk version.
    • Looking on maven repos for the (com/google/android/gms/tasks/TaskCompletionSource) .jar file or similars (com/google/android/gms) and adding them to the Plugins folder.