1

I'm trying to place ads in my android app but facing one issue. The logcat is saying

Failed to connect to remote ad service.
Could not start the ad request service.
Failed to load ad: 0

activity_main.xml -

    <com.google.android.gms.ads.AdView
    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="@string/banner_ad_unit_mainpg">
    </com.google.android.gms.ads.AdView>

java file - MobileAds.initialize(getApplicationContext(), "ca-app-pub-9368742373801645~2595542217");

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)        // All emulators
            .addTestDevice("3EF57886E34C0084")
            .build();

    mAdView.loadAd(adRequest);

I've tried running my app on emulator instead of real device but still ads are not loading. Everytime I get this error failed to load ad: 0

What mistake did I make in the implementation ? Any help would be appreciated.

Shantanu Singh
  • 345
  • 1
  • 5
  • 22

0 Answers0