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