AdMobs横幅:W / GooglePlayServicesUtil:谷歌Play服务的缺失 [英] AdMobs Banner: W/GooglePlayServicesUtil﹕ Google Play services is missing

查看:1129
本文介绍了AdMobs横幅:W / GooglePlayServicesUtil:谷歌Play服务的缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用<一个href=\"http://stackoverflow.com/questions/25445239/android-admob-banner-add-on-top-of-canvas\">this执行我的AdMob广告横幅,但我得到了一个错误:W / GooglePlayServicesUtil:谷歌播放服务是缺少

我已经添加以下​​行到的build.gradle

 编译com.google.android.gms:发挥服务的广告:8.4.0

下面是我的的onCreate()方法:

保护无效的onCreate(捆绑savedInstanceState){

  super.onCreate(savedInstanceState);    AdView中的AdView =新的AdView(本);
    adView.setAdSize(AdSize.BANNER);
    adView.setAdUnitId(testBanner);    RelativeLayout的布局=新的RelativeLayout(本);
    layout.setLayoutParams(新ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));    AdRequest中AdRequest中=新AdRequest.Builder()建立()。
    adView.loadAd(AdRequest中);    //全屏
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)。    //尺度图像
    显示显示= getWindowManager()getDefaultDisplay()。
    大小=新点();
    display.getSize(大小);
    dispX = size.x;
    dispY = size.y;
    BG = Bitmap.createScaledBitmap(BitmapFactory.de codeResource(
            getResources(),R.drawable.bg),dispX,dispY,真正的);
    LS = Bitmap.createScaledBitmap(BitmapFactory.de codeResource(
            getResources(),R.drawable.losescreen),GamePanel.rescaleX(805),GamePanel.rescaleY(1105),真);
    PB = Bitmap.createScaledBitmap(BitmapFactory.de codeResource(
            getResources(),R.drawable.playbutton),GamePanel.rescaleX(242),GamePanel.rescaleY(242),TRUE);    查看的GamePanel =新的GamePanel(本);    RelativeLayout.LayoutParams的AdParam =
            新RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                    RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.CENTER_HORIZONTAL);    layout.addView(的GamePanel);
    layout.addView(AD浏览,AdParam的);
    mInterstitialAd =新在InterstitialAd(本);
    的setContentView(布局);
    contextOfApplication = getApplicationContext();}


解决方案

进入到SDK管理器和下载谷歌播放服务,如果你还没有准备好,谷歌播放存储库

在这里输入的形象描述

http://jmsliu.com/2085/add -admob与 - 谷歌播放-service.html

这就是它。直到你安装这个在gradle这个该行表示什么。要打开SDK管理器:

在这里输入的形象描述

(envyandroid.com)

让我知道,如果在安装工作后,谷歌播放服务。如果有,一定要接受一个答案。如果您需要更多的帮助,请随时问我任何问题!

希望它帮助! : - )

I used this to implement my AdMob Banners, however I am getting an error: W/GooglePlayServicesUtil﹕ Google Play services is missing.

I have already added the following line to the build.gradle :

compile 'com.google.android.gms:play-services-ads:8.4.0'

Here is my onCreate() method:

protected void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);

    AdView adView = new AdView(this);
    adView.setAdSize(AdSize.BANNER);
    adView.setAdUnitId(testBanner);

    RelativeLayout layout = new RelativeLayout(this);
    layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);

    //fullscreen
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    //scale image
    Display display = getWindowManager().getDefaultDisplay();
    size = new Point();
    display.getSize(size);
    dispX = size.x;
    dispY = size.y;
    bg = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(
            getResources(), R.drawable.bg),dispX,dispY,true);
    ls = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(
            getResources(), R.drawable.losescreen),GamePanel.rescaleX(805),GamePanel.rescaleY(1105),true);
    Pb = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(
            getResources(), R.drawable.playbutton),GamePanel.rescaleX(242),GamePanel.rescaleY(242),true);

    View gamePanel = new GamePanel(this);

    RelativeLayout.LayoutParams adParams =
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                    RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.CENTER_HORIZONTAL);

    layout.addView(gamePanel);
    layout.addView(adView, adParams);


    mInterstitialAd = new InterstitialAd(this);
    setContentView(layout);
    contextOfApplication = getApplicationContext();

}

解决方案

Go into the SDK manager and download Google Play Services and, if you haven't already, Google Play Repository.

(http://jmsliu.com/2085/add-admob-with-google-play-service.html)

Thats it. That line in the gradle signifies nothing until you install this. To open the SDK manager:

(envyandroid.com)

Let me know if it worked after installing the Google Play Services. If it did, make sure to accept an answer. If you need more help, feel free to ask me any more questions!

Hope it helped! :-)

这篇关于AdMobs横幅:W / GooglePlayServicesUtil:谷歌Play服务的缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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