有趣的广告未在Live Android设备上显示,用于Unity 4.6中的游戏构建 [英] Interestial Ads Not Showing on Live Android Device for Game Build in Unity 4.6

查看:89
本文介绍了有趣的广告未在Live Android设备上显示,用于Unity 4.6中的游戏构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Unity版本==> 4.6.0

Admob版本==> Google移动广告Unity插件v3.1.3

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();

}

统一日志如下:

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)

但是在Real Android Device上,广告没有显示。

如何解决此问题?

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

推荐答案

我们中的许多人都面临着统一和admob的类似问题

Many of us facing similar problem with unity and admob

我只是通过以下步骤解决了这个问题:

I just solved this problem by following below steps:

1)我删除了Assets\Plugins\Android
中的 google-play-services_lib 文件夹2)然后选择Menu Assets->播放服务解析器-> Android解析器->解析客户端jar。

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刚按照这两个步骤操作,现在我的Google广告运行正常。
也许这个答案可以帮助您找出问题所在。

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

这篇关于有趣的广告未在Live Android设备上显示,用于Unity 4.6中的游戏构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆