简体   繁体   中英

Admob banner ads not working properly on Android

I am getting message in logcat while clicking on ADMOB-BANNER ADS

Could not get info for ad overlay

Hi I have integrate admob, and following it's xml code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.aviary.android.feather.library.services.drag.DragLayer
        android:id="@+id/dragLayer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/adView" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="?attr/aviaryBackgroundColor"
            android:orientation="vertical" >

            <!-- main navbar ( title, apply and done buttons ) -->

            <include
                android:id="@+id/aviary_navbar"
                layout="@layout/aviary_navbar" >
            </include>

            <!-- main content view -->

            <RelativeLayout
                android:id="@+id/main_content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@+id/aviary_bottombar"
                android:layout_below="@id/aviary_navbar"
                android:padding="?attr/aviaryMainImagePadding" >

                <!-- optional image view container -->

                <RelativeLayout
                    android:id="@+id/drawing_view_container"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
                </RelativeLayout>

                <!-- main image view -->

                <com.aviary.android.feather.sdk.widget.AviaryImageViewUndoRedo
                    android:id="@+id/image"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:visibility="invisible" />

                <!-- main loader, visible while loading the image at start -->

                <include
                    android:id="@+id/image_loading_view"
                    layout="@layout/aviary_main_loader" >
                </include>
            </RelativeLayout>

            <!-- bottom bar (tools, panels) -->

            <include
                android:id="@+id/aviary_bottombar"
                android:layout_width="match_parent"
                android:layout_height="?attr/aviaryBottomBarHeight"
                android:layout_alignParentBottom="true"
                layout="@layout/aviary_bottombar" >
            </include>

            <!-- popup container dialog -->

            <RelativeLayout
                android:id="@+id/feather_dialogs_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/aviary_navbar"
                android:visibility="invisible" >
            </RelativeLayout>

            <!-- hidden surface view -->

            <SurfaceView
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:visibility="invisible" >
            </SurfaceView>
        </RelativeLayout>
    </com.aviary.android.feather.library.services.drag.DragLayer>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/banner_ad_unit_id" >
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

It's Java code

AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

It's menifest file

<application>
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
    </application>

But whenever I click on banner ads, it's showing me click response but not transferring to play store or browswer

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <!-- Creating AdView in XML and loading an ad -->

    <com.google.android.gms.ads.AdView
        android:layout_alignParentBottom="true"
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="(Here paste your google add key)" />

</RelativeLayout>

MainActivity.java

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Get the view from activity_main.xml
        setContentView(R.layout.activity_main);

        AdView mAdView = (AdView) this.findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder()
        // Add a test device to show Test Ads
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
               .build();
        mAdView.loadAd(adRequest);
    }
}

AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.test.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!-- Include the AdActivity configChanges and theme. -->
    <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />
    <!-- Google Play Service Meta-data Info -->
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
</application>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM