简体   繁体   English

如何添加 admob 广告到助手?

[英]How to add admob ads to aide?

I'm using aide android application to create an android app but I have a problem with Admob ads everything is okay but when I run my app ads don't show我正在使用助手 android 应用程序来创建 android 应用程序,但我遇到了 Admob 广告问题,但当我运行我的应用程序时,广告没有显示

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
    android:layout_gravity="center">

</com.google.android.gms.ads.AdView>
public class MainActivity extends Activity 
{
private AdView mAdView; 

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    MobileAds.initialize(this, new OnInitializationCompleteListener(){
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus){
            
        }
    });
    
    mAdView = findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
}}

any help?有什么帮助吗?

Follow Admob Document step by step and register your testing device on your Admob Account.按照Admob 文档一步一步,在您的 Admob 帐户上注册您的测试设备。 You did all the things and also ads did not show then use the following simple technique.你做了所有的事情,广告也没有显示,然后使用以下简单的技术。

Sometimes testing ads also didn't show on debugging APK I don't know why but you can solve this problem by using a simple technique.有时测试广告也没有在调试 APK 时显示我不知道为什么,但您可以使用简单的技术解决此问题。 Change the package name and test ads on debugging APK.更改 package 名称并在调试 APK 上测试广告。 Finally, when you want to release the signed bundle put the original package name in the app and publish it.最后,当您要发布已签名的捆绑包时,请将原始 package 名称放入应用程序并发布。 this is only for testing purposes.这仅用于测试目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM