在android中添加admob后找不到类错误

时间:2014-05-05 17:28:03

标签: android xml admob

我已经在我的xml布局中添加了admob但是我得到的错误就像"找不到类"我已多次检查我的清单文件和我的xml代码,但我不知道如何解决它.. !! Plz帮忙!! Thanx提前

   The following classes could not be instantiated:

这是我在xml中的错误

    - com.google.ads.AdView (Open Class, Show Error Log)
      See the Error Log (Window > Show View) for more details.    java.lang.ClassNotFoundException: org.json.JSONException at java.net.URLClassLoader$1.run at java.net.URLClassLoader$1.run(                                                com.google.ads.AdView.a(SourceFile:352)
at com.google.ads.AdView.<init>(SourceFile:125)

我的清单文件的一部分

        <uses-permission android:name="android.permission.INTERNET" />
         <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
         <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
          <activity 
            android:name="com.google.ads.AdActivity"
                                      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
         ></activity>

我在xml中添加了admob代码enter code here

    <?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:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/secondpages1"
      android:orientation="vertical" >

<Button
    android:id="@+id/firebutton"
    android:layout_width="110dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="350dp"
    android:background="@drawable/firebutton" />

<com.google.ads.AdView
    android:id="@+id/adids"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    ads:adUnitId="My id"
    ads:loadAdOnCreate="true" />

      </LinearLayout>

0 个答案:

没有答案