gpt4 book ai didi

java - AdMobs 横幅 : W/GooglePlayServicesUtil﹕ Google Play services is missing

转载 作者:行者123 更新时间:2023-12-01 10:40:45 25 4
gpt4 key购买 nike

我用了this实现我的 AdMob 横幅,但我收到错误:W/GooglePlayServicesUtil:Google Play 服务缺失。

我已经将以下行添加到 build.gradle 中:

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

这是我的 onCreate() 方法:

protected void onCreate(Bundle savingInstanceState){

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

}

最佳答案

进入 SDK 管理器并下载 Google Play 服务,如果尚未下载,请下载 Google Play 存储库

enter image description here

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

就是这样。在你安装它之前,gradle 中的那一行没有任何意义。打开 SDK 管理器:

enter image description here

(envyandroid.com)

请告诉我安装 Google Play 服务后是否有效。如果是这样,请务必接受答案。如果您需要更多帮助,请随时向我询问更多问题!

希望对您有帮助! :-)

关于java - AdMobs 横幅 : W/GooglePlayServicesUtil﹕ Google Play services is missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34420435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com