可能这个问题是重复的,但它很奇怪......
我正在开发一个应用程序,其中我正在使用 AdView。代码在更新之前处于工作状态。目前我也更新了我的sdk to rev 22.0.0
和eclipse(我认为它给了我错误)。
我正在使用 2.2 版GoogleAds.jar
(添加到 libs 文件夹和内置路径中)。
也添加在清单文件中。
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
android:screenOrientation="landscape" />
我添加 jars 的文件夹是libs
. 它给了我错误
05-20 19:04:23.476: E/AndroidRuntime(29249): FATAL EXCEPTION: main
05-20 19:04:23.476: E/AndroidRuntime(29249): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abcd/com.abcd.activities.ScheduleActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.ads.AdView
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.os.Handler.dispatchMessage(Handler.java:99)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.os.Looper.loop(Looper.java:130)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread.main(ActivityThread.java:3687)
05-20 19:04:23.476: E/AndroidRuntime(29249): at java.lang.reflect.Method.invokeNative(Native Method)
05-20 19:04:23.476: E/AndroidRuntime(29249): at java.lang.reflect.Method.invoke(Method.java:507)
05-20 19:04:23.476: E/AndroidRuntime(29249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-20 19:04:23.476: E/AndroidRuntime(29249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
05-20 19:04:23.476: E/AndroidRuntime(29249): at dalvik.system.NativeStart.main(Native Method)
05-20 19:04:23.476: E/AndroidRuntime(29249): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.ads.AdView
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:684)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-20 19:04:23.476: E/AndroidRuntime(29249): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.Activity.setContentView(Activity.java:1660)
05-20 19:04:23.476: E/AndroidRuntime(29249): at com.abcd.activities.ScheduleActivity.onCreate(ScheduleActivity.java:77)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
05-20 19:04:23.476: E/AndroidRuntime(29249): ... 11 more
05-20 19:04:23.476: E/AndroidRuntime(29249): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader[/data/app/com.abcd-2.apk]
05-20 19:04:23.476: E/AndroidRuntime(29249): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-20 19:04:23.476: E/AndroidRuntime(29249): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-20 19:04:23.476: E/AndroidRuntime(29249): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
05-20 19:04:23.476: E/AndroidRuntime(29249): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
05-20 19:04:23.476: E/AndroidRuntime(29249): ... 22 more
我没有得到我所缺少的或我做错的地方。请帮我解决。
提前致谢。