2012-12-11 12 views
0

我得到這個非常討厭錯誤的logcatClassnot發現異常,同時與Android的AdMob處理橫幅

12-11 13:40:53.178: E/AndroidRuntime(4483): FATAL EXCEPTION: main 
12-11 13:40:53.178: E/AndroidRuntime(4483): java.lang.RuntimeException: Unable to resume activity {com.vahzay.android.smstrove/com.vahzay.android.smstrove.ListMessages}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2491) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2519) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2033) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.access$600(ActivityThread.java:127) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1179) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.os.Handler.dispatchMessage(Handler.java:99) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.os.Looper.loop(Looper.java:137) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.main(ActivityThread.java:4508) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at java.lang.reflect.Method.invokeNative(Native Method) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at java.lang.reflect.Method.invoke(Method.java:511) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at dalvik.system.NativeStart.main(Native Method) 
12-11 13:40:53.178: E/AndroidRuntime(4483): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.ads.AdView 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:741) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.inflate(LayoutInflater.java:491) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:252) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.Activity.setContentView(Activity.java:1837) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at com.vahzay.android.smstrove.ListMessages.onResume(ListMessages.java:650) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1159) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.Activity.performResume(Activity.java:4553) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2481) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  ... 12 more 
12-11 13:40:53.178: E/AndroidRuntime(4483): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.createView(LayoutInflater.java:554) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682) 
12-11 13:40:53.178: E/AndroidRuntime(4483):  ... 22 more 

我已經包括通過order and import AdMob廣告-SDK-的android.jar從

properties-->android-->java Build Path. 

是有什麼我需要處理添加在我的應用程序中添加?我的XML文件下面的代碼

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:android1="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#000000" > 

<com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    ads:adUnitId="xxxx" 
    ads:adSize="BANNER" 
    ads:testDevices="TEST_EMULATOR" 
    ads:loadAdOnCreate="true"/> ... 
+0

在'libs'文件夾中添加'admob-sdk-android.jar'文件。 –

+0

我已經在{libs}文件夾中添加了這個,但結果相同... – aneela

+0

您確定它位於'libs'文件夾中嗎? 'lib'是不同的。 – ThomasW

回答

0

我能夠通過我的項目/ libs文件夾添加到GoogleAdMobAdsSdk.jar解決問題。