Crash on Android plugin when using IMA sdk on Unity

118 views
Skip to first unread message

Andres Puente Rodriguez

unread,
Oct 6, 2022, 6:48:55 AM10/6/22
to Interactive Media Ads SDK

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):

--------- beginning of crash
10-05 12:09:25.259 2547 2547 E AndroidRuntime: FATAL EXCEPTION: main
10-05 12:09:25.259 2547 2547 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/tasks/TaskCompletionSource;
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.google.ads.interactivemedia.v3.internal.ajq.<init>(IMASDK:8)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.google.ads.interactivemedia.v3.internal.aij.<init>(IMASDK:1)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:6)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:4)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.VAST.NexIMAWrapper$3.run(NexIMAWrapper.java:484)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at android.os.Looper.loop(Looper.java:246)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8429)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
10-05 12:09:25.259 2547 2547 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.tasks.TaskCompletionSource
10-05 12:09:25.259 2547 2547 E AndroidRuntime: ... 12 more
10-05 12:09:25.261 1087 11212 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
10-05 12:09:25.262 1087 4843 D Debug : low && ship && 3rdparty app crash, do not dump
10-05 12:09:25.262 1087 4843 W ActivityManager: crash : com.10807
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

The crash is happening here.

Code (Java):

new Handler(context.getMainLooper()).post(new Runnable() {
   @override public void run() {
      Log.i("mycrash_onUI_thread", "Time to crash!");
      mAdsLoader = mSdkFactory.createAdsLoader(context, imaSdkSettings, adDisplayContainer);
      mAdsLoader.addAdErrorListener(instance);
      mAdsLoader.addAdsLoadedListener(instance);
   }
});

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

But, i believe this crash error is from internal android classes, that method createAdsLoader() is calling, so i'm not sure how can i solve it.

I've already tried:

  • Upgrading sdk & ndk android versions from 18 all the way to 32
  • Using unity versions 2020, 2021 & 2022 with latest android sdk versions.
  • 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/Android/libs folder after making the .arr plugin.
  • The .jar files that i've tried are all coming from different internet post trying to solve similar errors (none of them for the "NoClassDefFoundError: ... TaskCompletionSource"), this .jar files are:
    • Firebase-messaging
    • multidex
    • google-play-services
Can you confirm that createAdsLoader() method is using something related to the android class "TaskCompletionSource"?.
If thats the case, is there any workaround i could perform?

Kind regards,
Andres

IMA SDK

unread,
Oct 6, 2022, 2:32:12 PM10/6/22
to andp...@gmail.com, ima...@googlegroups.com
Hi Andres,

Thank you for reaching out to us. 

Please do note that IMA SDK don't have a direct support for Unity plugin, so kindly expect that there could be an error implementing this to a unity platform. In order for us to check this further, could you kindly provide at least a test project via Replay privately to author option? 
 

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=5004Q00002eyC7eQAE&entry.80707362=00152497

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.



Regards,
Google Logo
Teejay Wennie
IMA SDK Team
 


ref:_00D1U1174p._5004Q2eyC7e:ref

Andres Puente Rodriguez

unread,
Oct 7, 2022, 7:20:32 AM10/7/22
to Interactive Media Ads SDK
Hello
Thanks for your response.

I'm sorry but i prefer not to share my code. I''l try to handle it on my side. Thanks a lot anyways.

Sincerely
Andrés
Reply all
Reply to author
Forward
0 new messages