我正在尝试将 AdMob 广告添加到我的应用中,但是当我这样做时,一旦我启动我的应用,它就会崩溃。
这是我的 XML 代码:
<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"/>
另外,一旦我开始工作,我该如何设置广告的确切展示位置?谢谢
日志文件:
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