AdMob 6.4.1 crashes when startActivity with external intent

254 views
Skip to first unread message

Reno Ren

unread,
Sep 15, 2013, 4:56:41 AM9/15/13
to google-adm...@googlegroups.com
I'm writing an Android app with cocos2dx with AdMob embedded. It works well except that the app crashes when launch an external intent. It doesn't always happen, but with about 1/3 chance.

The log when it crashes:

09-15 00:23:23.540: I/Choreographer(18986): Skipped 30 frames!  The application may be doing too much work on its main thread.
09-15 00:23:33.451: I/Ads(19125): onReceiveAd()
09-15 00:23:34.232: W/A(19125): share
09-15 00:23:34.272: W/crash_handler(19125): Caught a crash, signum=11
09-15 00:23:34.272: E/webcore(19125): Report WebCore crash to the ErrorReportUtils at:Sun Sep 15 00:23:34 格林尼治标准时间+0800 2013


My layout xml:

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

    <org.cocos2dx.lib.Cocos2dxGLSurfaceView
        android:id="@+id/game_gl_surfaceview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

     <com.google.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="a152345aae52285"
        ads:loadAdOnCreate="true" />
</RelativeLayout>


The routine launches external intent:

    private void _share(String text) {
        Intent intent=new Intent(android.content.Intent.ACTION_SEND);
        intent.setType("image/*");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

        File file = new File(Environment.getExternalStorageDirectory().getPath() + "/dodgegame.jpg");
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        intent.putExtra(Intent.EXTRA_TEXT, text);
        startActivity(Intent.createChooser(intent, "How do you want to share?"));
    }

The crashes happen after "startActivity". Without AdMob, there was no problem with the program, so I'm pretty sure it's a bug of AdMob.

My environment:
AdMob: GoogleAdMobAdsSdk-6.4.1.jar
Android SDK: android-18
Android Ver: 4.1.1JRO03L

Eric Leichtenschlag

unread,
Sep 18, 2013, 7:34:50 PM9/18/13
to google-adm...@googlegroups.com
Hi Reno,

I'm not familiar with cocos2dx. Do you have a stack trace with the crash?

A side note on your XML layout - I'd recommend adding an android:layout_above="@+id/AdView" attribute on your SurfaceView, so that the ad sits below the surface, not on top of it.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages