AdMob “Not enough space to show ad” error

♀尐吖头ヾ 提交于 2019-12-04 10:45:48

It means there is no space for to display ad in your layout. Change it to RelativeLayout and align parent bottom.

<RelativeLayout
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >
        <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
        <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_below="@android:id/tabs"/>

    <com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:id="@+id/adView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="XXXXXXXXX"
            ads:loadAdOnCreate="true" 
            />
</RelativeLayout>

This is causing the issue.

 <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />

Your FrameLayout is occupying all the height on the view.So even if you write AdView below FrameLayout,It is getting 0 height.

Concider including AdMob at runtime inside your FrameLayout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!