简体   繁体   中英

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

<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. 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. Change the package name and test ads on debugging APK. Finally, when you want to release the signed bundle put the original package name in the app and publish it. this is only for testing purposes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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