Admob 3.1.0 showing errors in Unity 5.4.1f1

隐身守侯 提交于 2019-12-12 03:46:55

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/40003657/admob-3-1-0-showing-errors-in-unity-5-4-1f1

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