Interestial Ads Not Showing on Live Android Device for Game Build in Unity 4.6

橙三吉。 提交于 2019-12-31 05:37:27

问题


I am using Unity Version ==> 4.6.0
Admob Version ==> Google Mobile Ads Unity Plugin v3.1.3

I am using below code to show interstitial ads.

public const string adsIdAndroid = "ca-app-pub-3940256099942544/1033173712";
  public void RequestInterstitial()
    {
        try
        {
            if (!AdsFlag)
            {
                Debug.Log("Requested Interstitial");                          
               // Initialize an InterstitialAd.
                interstitial = new InterstitialAd(adsIdAndroid);
                // Create an empty ad request.
                AdRequest request = new AdRequest.Builder().Build();
                // Load the interstitial with the request.
                interstitial.LoadAd(request);
            }
        }
        catch (Exception ex) { }

    }

    public void ShowInterstitial()
    {
        try
        {
            //Debug.Log("Try Show InterstitialAd");
            if (!AdsFlag)
            {
                if (interstitial.IsLoaded())
                {
                    Debug.Log("Show InterstitialAd");
                    interstitial.Show();
                    AdsFlag = true;
                }
                else
                {
                    Debug.Log("InterstitialAd Not Loaded");
                    RequestInterstitial();
                }
            }
        }
        catch (Exception ex) { }
    }

I am calling above function as below :

    void Start()
        {
            AdsFlag = false;
            RequestInterstitial();
    }
 void Update()
    {
        ShowInterstitial();

}

Unity Log As Below :

Requested Interstitial
UnityEngine.Debug:Log(Object)
Dummy CreateInterstitialAd
UnityEngine.Debug:Log(Object)
Dummy LoadAd
UnityEngine.Debug:Log(Object)
Dummy IsLoaded
UnityEngine.Debug:Log(Object)
Show InterstitialAd
UnityEngine.Debug:Log(Object)
Dummy ShowInterstitial
UnityEngine.Debug:Log(Object)

But on Real Android Device , ads not showing up..
How to solve this problem ?


回答1:


Many of us facing similar problem with unity and admob

I just solved this problem by following below steps:

1) I have deleted google-play-services_lib folder at Assets\Plugins\Android 2) Then Select Menu Assets -> Play Service Resolver -> Android Resolver -> Resolve Client Jars.

I just followed this 2 steps and now my google ads working fine. Maybe this answer help you to figure out problem.



来源:https://stackoverflow.com/questions/41531875/interestial-ads-not-showing-on-live-android-device-for-game-build-in-unity-4-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!