请帮忙。每当我运行我的新应用程序时,都会出现无数错误。例如“不幸的是应用名称已停止”
这是我的清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.benchaful.newboard"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:targetSdkVersion="17" android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
</manifest>
我的主要布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout"
android:orientation="vertical"
android:layout_height="wrap_content"
android:background="#000000"
>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/accesskey"
android:layout_width="fill_parent"
android:layout_height="100px"
/>
</LinearLayout>
</ScrollView>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout"
>
<com.google.ads.AdView xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads"
android:id="@+id/adView"
ads:adSize="320x50"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a151a7cc8c54403"
/>
</LinearLayout>
</RelativeLayout>
还有我的 LogCat
06-08 11:25:38.923: E/AndroidRuntime(12250): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.benchaful.newboard/com.benchaful.newboard.MainActivity}: android.view.InflateException: Binary XML file line #353: Error inflating class com.google.ads.AdView
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread.access$700(ActivityThread.java:140)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.os.Looper.loop(Looper.java:137)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread.main(ActivityThread.java:4944)
06-08 11:25:38.923: E/AndroidRuntime(12250): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 11:25:38.923: E/AndroidRuntime(12250): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
06-08 11:25:38.923: E/AndroidRuntime(12250): at dalvik.system.NativeStart.main(Native Method)
06-08 11:25:38.923: E/AndroidRuntime(12250): Caused by: android.view.InflateException: Binary XML file line #353: Error inflating class com.google.ads.AdView
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.createView(LayoutInflater.java:619)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:318)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.Activity.setContentView(Activity.java:1924)
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.benchaful.newboard.MainActivity.onCreate(MainActivity.java:37)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.Activity.performCreate(Activity.java:5188)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2085)
06-08 11:25:38.923: E/AndroidRuntime(12250): ... 11 more
06-08 11:25:38.923: E/AndroidRuntime(12250): Caused by: java.lang.reflect.InvocationTargetException
06-08 11:25:38.923: E/AndroidRuntime(12250): at java.lang.reflect.Constructor.constructNative(Native Method)
06-08 11:25:38.923: E/AndroidRuntime(12250): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-08 11:25:38.923: E/AndroidRuntime(12250): at android.view.LayoutInflater.createView(LayoutInflater.java:593)
06-08 11:25:38.923: E/AndroidRuntime(12250): ... 23 more
06-08 11:25:38.923: E/AndroidRuntime(12250): Caused by: java.lang.RuntimeException: Could not initialize AdView: Required XML attribute "adSize" missing
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.google.ads.AdView.a(SourceFile:402)
06-08 11:25:38.923: E/AndroidRuntime(12250): at com.google.ads.AdView.<init>(SourceFile:125)
06-08 11:25:38.923: E/AndroidRuntime(12250): ... 26 more
我将非常感谢任何帮助。
这是我的属性文件
<resources>
<declare-styleable name="com.google.ads.AdView">
<attr name="adSize">
<enum name="BANNER" value="1"/>
<enum name="IAB_MRECT" value="2"/>
<enum name="IAB_BANNER" value="3"/>
<enum name="IAB_LEADERBOARD" value="4"/>
<enum name="SMART_BANNER" value=5/>
</attr>
<attr name="adUnitId" format="string"/>
</declare-styleable>
</resources>