-1

私は Android アプリで作業しています。レイアウト xml に admob を追加すると、作成中にアクティビティがクラッシュしましたが、xml から admob を削除すると、アプリはうまく機能します。空の活動はとてもうまくいきます

    e10-04 14:08:42.509: E/AndroidRuntime(31802): FATAL EXCEPTION: main
10-04 14:08:42.509: E/AndroidRuntime(31802): java.lang.RuntimeException: Unable to start activity ComponentInfo{appinventor.ai_Yousefodeh1.tvquran/com.spapps.tvq.Mp3Quran1Activity}: android.view.InflateException: Binary XML file line #245: Error inflating class com.google.ads.AdView
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.os.Looper.loop(Looper.java:137)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread.main(ActivityThread.java:4898)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at java.lang.reflect.Method.invokeNative(Native Method)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at java.lang.reflect.Method.invoke(Method.java:511)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at dalvik.system.NativeStart.main(Native Method)
10-04 14:08:42.509: E/AndroidRuntime(31802): Caused by: android.view.InflateException: Binary XML file line #245: Error inflating class com.google.ads.AdView
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:308)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.Activity.setContentView(Activity.java:1924)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at com.spapps.tvq.Mp3Quran1Activity.onCreate(Mp3Quran1Activity.java:173)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.Activity.performCreate(Activity.java:5206)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
10-04 14:08:42.509: E/AndroidRuntime(31802):    ... 11 more
10-04 14:08:42.509: E/AndroidRuntime(31802): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView
10-04 14:08:42.509: E/AndroidRuntime(31802):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.createView(LayoutInflater.java:552)
10-04 14:08:42.509: E/AndroidRuntime(31802):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
10-04 14:08:42.509: E/AndroidRuntime(31802):    ... 23 more

これは私のレイアウトコードです

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
 >


 <LinearLayout 

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/abc_bg"
    android:gravity="center_horizontal"
    android:orientation="vertical" >




    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/abc_title_bg" >

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="10dp"
                    android:orientation="vertical" >

                    <TextView
                        android:id="@+id/recitername"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="Idrees Abkr "
                        android:textColor="#ececec"
                        android:textSize="11pt"
                        android:singleLine="true"
                         />

                    <TextView
                        android:id="@+id/surahname"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="1- Surah Al-Fatihah"
                        android:textColor="#ffaa16"
                        android:textSize="8pt" />
                </LinearLayout>

                <CheckBox
                    android:id="@+id/fv"
                    style="?android:attr/starStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="20dp"
                    android:text="" />
            </FrameLayout>
        </LinearLayout>
    <LinearLayout

    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal|bottom"
    android:orientation="horizontal"
    android:layout_marginTop="30dp"
     >
            <ImageView
                android:layout_weight="1"
            android:id="@+id/repeat"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/repeat_off" 
            android:layout_gravity="center"/>
        <ImageView

            android:id="@+id/previous"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/abc_playbackselector" 
            android:layout_gravity="center"/>
        <FrameLayout

            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

             > 
            <ImageView
                android:id="@+id/play"
                android:layout_width="30pt"
                    android:layout_height="30pt"

                android:src="@drawable/abc_playselector"
                android:gravity="center"
                android:layout_gravity="center" />
                       <ProgressBar
       android:id="@+id/bufferingProgressBar"
       style="?android:attr/progressBarStyleLarge"
       android:layout_gravity="center"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:visibility="invisible"
       />
        </FrameLayout> 
        <ImageView

            android:id="@+id/next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/abc_playnextselector"
            android:layout_gravity="center" />
                    <ImageView
                        android:layout_weight="1"
            android:id="@+id/random"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/shuffle_off"
            android:layout_gravity="center" />
     </LinearLayout> 

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal" >
        <TextView 
            android:id="@+id/elapsedTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="00:00"
            android:textColor="#f5f8f7"
            android:paddingLeft="10dp"/>
         <TextView 
            android:id="@+id/durationTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="00:00"
            android:textColor="#f5f8f7"
            android:paddingRight="10dp"/>
    </LinearLayout>

    <SeekBar

        android:id="@+id/seekBar1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        style="@style/CustomSeekBar"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:paddingBottom="5dp"
        android:paddingTop="1dip"
        />

    <LinearLayout 

    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:orientation="horizontal" >
        <ImageView
            android:id="@+id/pages"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/pages_selector"
            android:layout_gravity="center_horizontal|bottom" 
            android:layout_weight="1"/>

        <ImageView

            android:id="@+id/playlist"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/playlist_selector"
            android:layout_gravity="center_horizontal|bottom"
            android:layout_weight="1" />

        <ImageView
            android:visibility="gone"
            android:id="@+id/favorites"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/favorites"
            android:layout_gravity="center_horizontal|bottom"
            android:layout_weight="1" />
     </LinearLayout> 


     <LinearLayout 

        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal|top"
        android:orientation="horizontal" >

    <com.spapps.tvq.TextViewWithFont
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/Pages"
        android:paddingBottom="5dp"
        android:gravity="center_horizontal|top"
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:textColor="#ffffff"
        android:layout_weight="1"/>
    <com.spapps.tvq.TextViewWithFont

        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/PlayList"
        android:paddingBottom="5dp"
        android:gravity="center_horizontal|top"
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:textColor="#ffffff"
        android:layout_weight="1"/>
     </LinearLayout> 

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="@drawable/abc_title_bg"
        android:layout_marginTop="10dp" >


            <WebView
        android:id="@+id/mainWebView"
        android:layout_width="fill_parent"
        android:layout_height="78dp"
        android:layout_gravity="center"
        android:scrollbars="none"
        android:visibility="gone"


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



    </FrameLayout>


        <LinearLayout 
            android:layout_weight="1"
            android:baselineAligned="false"
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal|bottom"
            android:padding="1dp">
            <LinearLayout
                                    android:layout_width="fill_parent"
                                    android:layout_height="50dp"
                                    android:layout_weight="1"
                    android:clickable="true"
                    android:orientation="vertical"
                    android:background="@drawable/abc_lftselector" 
                     android:id="@+id/allRecitersButton">

                    <com.spapps.tvq.TextViewWithFont
                        android:id="@+id/allRecitersButton_abc"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="12dp"
                        android:text="@string/RecitersList"
                        android:textColor="#ffaa16"
                        android:textSize="9pt" />

                </LinearLayout>

                <LinearLayout
                                    android:layout_width="fill_parent"
                                    android:layout_height="50dp"
                                    android:layout_weight="1"
                                    android:clickable="true"
                                    android:orientation="vertical"
                                    android:background="@drawable/abc_rtselector"
                                    android:id="@+id/allSurahsButton" >

                    <com.spapps.tvq.TextViewWithFont
                        android:id="@+id/play_all_t"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="12dp"
                        android:text="@string/SurahsList"
                        android:textColor="#ffaa16"
                        android:textSize="9pt" />

                </LinearLayout>
                           </LinearLayout>




<Button
    android:layout_weight="1"
    android:visibility="gone"
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="الصفحات"
        />


</LinearLayout>

    <ImageView 
    android:src="@drawable/corner_top_left"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top|left"
    android:visibility="gone"
                />

        <ImageView 
    android:src="@drawable/corner_top_right"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top|right"
    android:visibility="gone"
                />



    <CheckBox 
        android:layout_gravity="top|right"
        android:id="@+id/star" 
    style="?android:attr/starStyle" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:checked="false"
                   android:focusable="false"
               android:focusableInTouchMode="false"
               android:visibility="gone"

    />

    <ListView
        android:id="@+id/updateList"
        android:visibility="invisible"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_gravity="bottom|right"/>

    <SlidingDrawer
        android:id="@+id/slidingDrawer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:orientation="horizontal"
        android:layout_gravity="center_vertical" 
        android:visibility="visible"
        >

        <ImageView
            android:id="@+id/handle"
            android:src="@drawable/handel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             />

        <LinearLayout
            android:id="@+id/content"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:background="@drawable/drawer_arc"
            android:gravity="center_vertical"
            android:orientation="vertical"
            android:clickable="true">

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="الاعدادات"
                android:gravity="right"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:visibility="gone" />


    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingLeft="40dp" 
    android:layout_weight="1">

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView

                android:visibility="invisible"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/repeat_off"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text=" "
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:id="@+id/play_next"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/play_next_off"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/PlayNext"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>



     </LinearLayout>

    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingLeft="40dp" 
    android:layout_weight="1">

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:id="@+id/rate"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/rate_selector"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/Rate"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:id="@+id/sleep"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/sleep_selector"
                 />
            <TextView
                android:id="@+id/sleep_title"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/Sleep"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>



     </LinearLayout>

     <FrameLayout         
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="40dp"
        >
            <WebView
        android:id="@+id/drawerWebView"
        android:layout_width="250dp"
        android:layout_height="75dp"
        android:layout_gravity="center"
        android:scrollbars="none"
        />
    </FrameLayout>



    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingLeft="40dp" 
    android:layout_weight="1">

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:id="@+id/share"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/share_selector"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/Share"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:id="@+id/language"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/language_selector"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/Language"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>

     </LinearLayout>

    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingLeft="40dp" 
    android:layout_weight="1">

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView
                android:visibility="invisible"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/repeat_off"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text=" "
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>

        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:layout_weight="1">
            <ImageView

                android:id="@+id/exit"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/exit_selector"
                 />
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/Exit"
                android:paddingTop="1dp"
                android:paddingBottom="5dp"
                android:gravity="center_horizontal|top"
                android:textAppearance="?android:attr/textAppearanceSmall" 
                android:textColor="#ffffff"
                /> 
        </LinearLayout>



     </LinearLayout>

  </LinearLayout>

    </SlidingDrawer>


</FrameLayout>
4

1 に答える 1