0

I'm trying to add AdMob ads to my app but when I do it, as soon as I launch my app it crashes.

This is my XML code:

<com.google.ads.AdView 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adUnitId="mydevid"
    ads:adSize="BANNER"
    ads:testDevices="mydeviceid"
    ads:loadAdOnCreate="true"/>

Also, once I get it to work, how do I set where exactly is the ad going to be shown? Thank you

Logcat file:

06-13 23:41:03.576: E/AndroidRuntime(17419): FATAL EXCEPTION: main
06-13 23:41:03.576: E/AndroidRuntime(17419): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.matthewstudios.gw2legendary/com.example.gw2legendary.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class com.google.ads.AdView
Guy
  • 6,414
  • 19
  • 66
  • 136

1 Answers1

0

I don't want to leave the question unanswered so I'll just link to the awesome answer that helped me solve the problem!

Follow these stepes and adMob will work 100%!

Community
  • 1
  • 1
Guy
  • 6,414
  • 19
  • 66
  • 136