我正在尝试在我的应用中实现 admob,但添加后应用无法启动。
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads= "http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageButton
android:id="@+id/ts"
android:contentDescription="@string/tts_contentDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@android:drawable/ic_btn_speak_now"
/>
<ImageButton
android:id="@+id/search"
android:contentDescription="@string/search_contentDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/ts"
android:src="@android:drawable/ic_search_category_default"
/>
<AutoCompleteTextView
android:id="@+id/edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:singleLine="true"
android:layout_toLeftOf="@id/search"
android:hint="@string/edit_hint"
/>
</RelativeLayout>
<WebView
android:id="@+id/result"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="myId"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"
/>
</LinearLayout>