Admob 3.1.0显示Unity 5.4.1f1中的错误 [英] Admob 3.1.0 showing errors in Unity 5.4.1f1

查看:107
本文介绍了Admob 3.1.0显示Unity 5.4.1f1中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Unity 5.4.1f1
我有admob Unity sdk版本3.1.0



我设置了一个admob帐户,然后按照



当我玩游戏时,我收到以下消息





此处这些错误之一的完整版本

 警告:(不需要兼容版本的com.android.support:support-v4 com.android.support:appcompat-v7:23.1.0+、com.google.android.gms:play-services-basement:9.6.1),将尝试使用最新版本24.0.0 
UnityEngine.Debug:Log(Object)
Google.JarResolver.PlayServicesSupport:Log(String,Boolean)
Google.JarResolver.PlayServicesSupport:ResolveDependencies(Boolean)
GooglePlayServices.ResolverVer1_1: DoResolutionNoAndroidPackageChecks(PlayServicesSupport,String,OverwriteConfirmation)
GooglePlayServices。< DoResolution> c__AnonStorey1:<> m__0()
GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport,String,OverwriteConfirmation,Action) .PlayServicesResolver:Resolve(Action)
GooglePlayServices.PlayServicesResolver:AutoResolve()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

请注意,我已经在使用Chartboost。



到目前为止,我无法在编辑器或带有以下内容的版本中显示admob广告以下代码。

  private void RequestAdmobInterstitial()
{
#if UNITY_ANDROID
string adUnitId =我的广告单元ID;
#elif UNITY_IPHONE
字符串adUnitId = INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE;
#else
字符串adUnitId = unexpected_platform;
#endif

//初始化InterstitialAd。
InterstitialAd interstitial = new InterstitialAd(adUnitId);
//创建一个空的广告请求。
AdRequest请求=新的AdRequest.Builder()。Build();
//使用请求加载非页内广告。
interstitial.LoadAd(request);
}

在构建中什么也没有发生,在编辑器中我收到这些消息





这些错误为何起作用?
如果可以,我该如何解决?

解决方案

此错误:

 警告:无兼容版本的com.android.support:support-v4 

抱怨它的脚本是google play jar解析器。它会从您的Android SDK位置中获取所有必需的android库,并且找不到所需的库。



这很可能意味着您缺少android支持库



要解决此问题,请打开Android SDK管理器(很可能是通过Android Studio),并确保您的支持库是最新的。



在您需要的同时,也要更新Google Play服务,不会造成伤害,并可能在以后为您节省错误。




I have Unity 5.4.1f1 I have the admob Unity sdk version 3.1.0

I setup an admob account, and then followed these steps

When I do a build for Android I get the following errors

When I play I get the following messages

Heres the full version of one of those errors

    WARNING: No compatible versions of com.android.support:support-v4 required by (com.android.support:appcompat-v7:23.1.0+, com.google.android.gms:play-services-basement:9.6.1), will try using the latest version 24.0.0
    UnityEngine.Debug:Log(Object)
    Google.JarResolver.PlayServicesSupport:Log(String, Boolean)
    Google.JarResolver.PlayServicesSupport:ResolveDependencies(Boolean)
    GooglePlayServices.ResolverVer1_1:DoResolutionNoAndroidPackageChecks(PlayServicesSupport, String, OverwriteConfirmation)
    GooglePlayServices.<DoResolution>c__AnonStorey1:<>m__0()
    GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
    GooglePlayServices.PlayServicesResolver:Resolve(Action)
    GooglePlayServices.PlayServicesResolver:AutoResolve()
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Note that I already have Chartboost working.

I have so far been unable to display an admob ad in the editor or in a build with the following code.

    private void RequestAdmobInterstitial()
    {
        #if UNITY_ANDROID
        string adUnitId = "my ad unit id";
        #elif UNITY_IPHONE
            string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
            string adUnitId = "unexpected_platform";
        #endif

        // Initialize an InterstitialAd.
        InterstitialAd interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }

In a build nothing happens, in the editor I get these messages

Are these errors why it is it working? If so how do I fix them?

解决方案

This error:

WARNING: No compatible versions of com.android.support:support-v4

The script complaining about it is the google play jar resolver. It grabs all the necessary android libraries from your Android SDK location, and it can't find the libraries it wants.

This most likely means you are missing the android support libraries in your Android SDK folder.

To fix this, open up the Android SDK manager (most likely via Android Studio) and make sure you have the support libraries up to date.

While you're at it, update google play services too, cant hurt and might save you errors down the road.

这篇关于Admob 3.1.0显示Unity 5.4.1f1中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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