二进制XML文件行#1:错误导致类com.google.ads.AdView

时间:2014-11-12 05:01:37

标签: java c# android xamarin

我收到此错误:二进制XML文件行#1:错误导致类com.google.ads.AdView

在他的路线上:

SetContentView (Resource.Layout.Main);

这是我的主要代码:

<?xml version="1.0" encoding="utf-8"?>
<TextView
android:text="White Noise"
android:id="@+id/textView16"
android:textColor="#ff0a0505"
android:typeface="normal"
android:textStyle="bold"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="30.2dp"
android:layout_marginBottom="25.1dp"
android:textSize="24dp"
android:editable="false"
android:enabled="true" />
<TableLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tableLayout2"
android:shrinkColumns="2">
<TableRow
android:id="@+id/tableRow6">
<TextView
 android:text="length: "
 android:id="@+id/Length1"
 android:textColor="#ff030000"
 android:enabled="false"
 android:editable="false"
 android:typeface="normal"
 android:textSize="22dp"
 android:layout_column="0" />
<EditText
 android:inputType="date"
 android:id="@+id/editText1"
 android:textColor="#ff1e31bd"
 android:background="#ffeef6f5"
 android:text="5"
 android:layout_column="1"
 android:layout_width="92.0dp" />
 <TextView
 android:text="Mins"
 android:layout_column="2"
 android:id="@+id/textView12"
 android:textColor="#ff030000"
 android:enabled="false"
 android:editable="false" />
 </TableRow>
 </TableLayout>
 <SeekBar
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:id="@+id/seekBar1" />
 <Button
 android:id="@+id/myButton"
 android:text="Play"
 android:layout_width="match_parent"
 android:layout_height="wrap_content" />
 <Button
 android:id="@+id/button1"
 android:text="Stop"
 android:layout_column="0"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:enabled="true" />
 <com.google.ads.AdView
 android:id="@+id/ad"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 ads:adUnitId="ca-app-pub-3972562323687644/9363983016"
 ads:loadAdOnCreate="true"
 ads:adSize="BANNER" />

这是我的Android Manifest文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="4.0"         
package="com.noiser.myapp" android:versionCode="4">
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:icon="@drawable/pic" android:label="Noiser">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="ca-app-pub-
3972562323687644/9363983016" />
<meta-data android:name="com.google.android.gms.version"    
android:value="@integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

谁能告诉我我做错了什么?

1 个答案:

答案 0 :(得分:1)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:ads="http://schemas.android.com/apk/res-auto" // added this line in xml file

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<com.google.ads.AdView
    android:id="@+id/ad"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3972562323687644/9363983016"
    ads:loadAdOnCreate="true" />