2

I tried to implement MediationTestSuite into my Unity Game, but I got this exception and therefore couldn't see MediationTestSuite

Exception:

java.lang.IllegalStateException: setAdListener must be called on the main UI thread.
        at lr.b(:com.google.android.gms.policy_ads_fdr_dynamite@21001000@21001000.272763194.272763194:1)
        at com.google.android.gms.ads.nonagon.shim.f.a(:com.google.android.gms.policy_ads_fdr_dynamite@21001000@21001000.272763194.272763194:14)
        at com.google.android.gms.ads.nonagon.shim.g.a(:com.google.android.gms.policy_ads_fdr_dynamite@21001000@21001000.272763194.272763194:4)
        at com.google.android.gms.ads.internal.client.ap.a(:com.google.android.gms.policy_ads_fdr_dynamite@21001000@21001000.272763194.272763194:62)
        at ff.onTransact(:com.google.android.gms.policy_ads_fdr_dynamite@21001000@21001000.272763194.272763194:4)
        at android.os.Binder.transact(Binder.java:667)

My code is

public void OnButtonClick()
{
    GoogleMobileAdsMediationTestSuite.Api.MediationTestSuite.Show();
}

Binded on single button in scene.

​​​I've tried to do this directly in Update method by dispatching this call, also tried to create empty Unity project and by adding into it only GoogleMobileAds-v4.1.0 + GoogleMobileAdsUnityAdsMediation + GoogleMobileAdsMediationTestSuite all downloaded directly from Google links.

Is there something I'm missing here, or is it just MediationTestSuite that is bugged and calles some UI stuff in separate thread?

It's definetely not a duplicate of AdMob Interstitial and error isLoaded must be called on the main UI thread since it's in Unity and I do not have access to MeditationTestSuite library code.

  • Possible duplicate of [AdMob Interstitial and error isLoaded must be called on the main UI thread](https://stackoverflow.com/questions/28501787/admob-interstitial-and-error-isloaded-must-be-called-on-the-main-ui-thread) – Style-7 Nov 15 '19 at 15:48

1 Answers1

0

Well. It was all simple. Apparentely MediationTestSuite throws this kind of exception when you unity build doesn't have "development build" mark. But I did have it. The case was that I should've used assembleDebug in gradle build tasks. I've got this problem because I builded my android manually by exporting into android project instead of building with unity.