Unity: Test Ads Wont show up Please HELP

139 views
Skip to first unread message

Shabreen Anjum

unread,
May 21, 2021, 6:09:40 AM5/21/21
to Google Mobile Ads SDK Developers
Test ads won't show up on my Android Device I have the Google play services and the Google Repository installed with sdk manager and here is my 

I don't get any errors it just doesn't display the test ads. What am I missing? please help.
here is my AdManager script->

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using System;

public class AdManager : MonoBehaviour
{

    private InterstitialAd interstitial;
    private string adUnitId, appid;

    [Obsolete]
    public void Start()
    {
        appid = "ca-app-pub-*****************";
        adUnitId = "ca-app-pub-3940256099942544/1033173712";   
        MobileAds.Initialize(appid);
        RequestInterstitial();
    }


    public void RequestInterstitial()
    {
        // Initialize an InterstitialAd.
        this.interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = AdRequestBuild();
        // Load the interstitial with the request.
        this.interstitial.LoadAd(request);

        this.interstitial.OnAdLoaded += HandleOnAdLoaded;
        // Called when an ad request failed to load.
        this.interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
        // Called when an ad is shown.
        this.interstitial.OnAdOpening += HandleOnAdOpened;
        // Called when the ad is closed.
        this.interstitial.OnAdClosed += HandleOnAdClosed;
        // Called when the ad click caused the user to leave the application.
        this.interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

    }

    private void HandleOnAdLeavingApplication(object sender, EventArgs e)
    {
        throw new NotImplementedException();
    }

    public void HandleOnAdLoaded(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleAdLoaded event received");
    }

    public void HandleOnAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        MonoBehaviour.print("HandleFailedToReceiveAd event received with message: "
                            + args.Message);
    }

    public void HandleOnAdOpened(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleAdOpened event received");
    }

    public void HandleOnAdClosed(object sender, EventArgs args)
    {
        MonoBehaviour.print("HandleAdClosed event received");
    }



    public void interstitial_Show()
    {

        if (this.interstitial.IsLoaded())
        {
            this.interstitial.Show();
        }
        else
        {
            Debug.Log("error");
        }
    }

    AdRequest AdRequestBuild()
    {
        return new AdRequest.Builder().Build();
    }

}

when I build my app after force resolve it gives me some error, which I attach with mail. 

B4EED67C-1577-41DC-878A-333E569D7E4B.jpeg

Shabreen Anjum

unread,
May 21, 2021, 6:11:21 AM5/21/21
to Google Mobile Ads SDK Developers
F0A304C0-AE2E-42DA-868E-6A199F93A144.jpeg
DD1EEEFE-DD7D-4A6E-855B-49F97A22B033.jpeg
3A635C83-D608-49E6-A214-DED6A5D55114_4_5005_c.jpeg

Mobile Ads SDK Forum Advisor Prod

unread,
May 21, 2021, 10:59:57 AM5/21/21
to shab...@linkites.com, google-adm...@googlegroups.com
Hi Shabreen,

Are you able to run your app? I am asking because when searching with Google for "unity type bitter.jnibridge.jnibridge$a is defined multiple times" I found the complaints were that the apk couldn't be compiled. You may want to check stackoverflow too for this build issue.

I just now compiled with Unity 2020.3.8f1 an app with Interstitials that ran on a Xiaomi Mi A2 Android 10 phone following our quick start and Interstitial guide with deleting the OnAdLeavingApplication event and switching AdErrorEventArgs class in favor of AdError as described in the release notes and the app ran. Are there any other steps to take to see the errors you are encountering?

If you are using the latest Mobile Ads unityplugin version 6.0 then you will need to change MobileAds.Initialize(appid); to MobileAds.Initialize(initStatus => { });. this is separate from the other errors you are encountering though.

Regards,

Google Logo
Aryeh Baker
Mobile Ads SDK Team
 

 

ref:_00D1U1174p._5004Q2HCeIx:ref

Shabreen Anjum

unread,
May 21, 2021, 2:40:39 PM5/21/21
to Mobile Ads SDK Forum Advisor Prod, google-adm...@googlegroups.com
No I'm unable to Create apk. Is this because of unity version?? I'm using unity 2020.1.16.

Mobile Ads SDK Forum Advisor Prod

unread,
May 21, 2021, 3:47:10 PM5/21/21
to shab...@linkites.com, google-adm...@googlegroups.com
Hi Shabreen,

I just created the same app in unity 2020.1.16 and it worked. As the Unity build system can be tedious could you tell me the exact steps you took that are different from the way our guide suggests?
Reply all
Reply to author
Forward
0 new messages