BUG REPORT

546 views
Skip to first unread message

Charlie

unread,
Apr 15, 2011, 5:28:09 PM4/15/11
to Google AdMob Ads Developers
I am receiving this error stack trace in my Android Error Console with
every app using this SDK

java.lang.NullPointerException
at
android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:
735)
at android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:
557)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)

http://code.google.com/p/android/issues/detail?id=10789

wes

unread,
Apr 15, 2011, 7:49:17 PM4/15/11
to google-adm...@googlegroups.com
I'm not sure there's much we can do within the SDK to combat this, as it's an Android issue.  For now, maybe the advice in comment 26 is best: wrap your ad-calling code in something like this:
WebViewDatabase webViewDB = WebViewDatabase.getInstance(this);
if (webViewDB!=null) {
    // spin up your ad view
}
maybe with a check beforehand to see if the android version is > 2.3 (which would make this check unnecessary, since it should have been fixed in that version).

Cheers,
Wes
Message has been deleted

Mark Carter

unread,
Jun 26, 2011, 10:25:16 AM6/26/11
to google-adm...@googlegroups.com
Please could you confirm which SDK version this is fixed for.

>= SDK 9

?

Mark Carter

unread,
Jun 26, 2011, 7:43:40 PM6/26/11
to google-adm...@googlegroups.com
I'm using the workaround described by Wes, but have a report from one user that the bug is still happening:

Atrix 4g
SDK Level: 8
MB860
GingerBlur 4.5

wes

unread,
Jun 27, 2011, 3:47:01 PM6/27/11
to google-adm...@googlegroups.com
Well, like the bug report said: it seems to have been fixed in Android 2.3, which is SDK Level 9, which explains why you're still seeing this on an SDK Level 8 device.

-Wes

Mark Carter

unread,
Jun 27, 2011, 8:22:55 PM6/27/11
to google-adm...@googlegroups.com
Hi Wes - thanks for your feedback.

Please reread what I wrote. I am using the workaround but this is not sufficient (for pre-Gingerbread devices). 

Emax

unread,
Aug 11, 2011, 6:28:25 AM8/11/11
to google-adm...@googlegroups.com
I agree with Mark, I have used the same workaround, but it is not sufficient.
I continue to receive NPE report from users using this "patched" version.

By the way in the report it usually associated to a call to WebViewDatabase.getCacheTotalSize()returning the NPE I would like to try to call it directly, but I cannot find this function as a usabel method of webviewdatabase, there is a way to force a call to it? this way I can force the NPE and catch it disabling the ads

William Ferguson

unread,
Aug 11, 2011, 11:13:13 AM8/11/11
to Google AdMob Ads Developers
A suggested solution posted elsewhere on this forum, is to call
WebView#clearCache before you start loading ads.
This is because WebView doesn't handle it's cache (among lots of other
things) well.
The end result being the NPE you are experiencing.

Mark Carter

unread,
Aug 12, 2011, 9:19:12 PM8/12/11
to google-adm...@googlegroups.com
Is the purpose of calling WebView#clearCache() to detect whether the exception will happen, or will it actually prevent the exception from happening from within the admob code?

Emax

unread,
Aug 16, 2011, 6:31:19 AM8/16/11
to google-adm...@googlegroups.com
Yes, this way it works.
I use it to detect if something goes wrong and disable the ads.
I catch anything and in the case I disable the ads
I received no more report in last 5 days, I hope I have resolved

For anyone interested my approch is the following (I hope I can help someone):

               boolean bError = false;
try {
WebViewDatabase webViewDB = WebViewDatabase.getInstance( this );
if (webViewDB == null)
bError = true;
WebView oww = new WebView( this );
oww.clearCache( true );
} catch( Throwable anyhing ) {
bError = true;
}

try {
if (!bError) {
                               // ... do my stuff for the ads from admob 
}
} catch( Throwable anyhing ) {
bError = true;


DANGDUT KOPLO NEW PALLAPA

unread,
May 5, 2018, 6:10:38 PM5/5/18
to Google Mobile Ads SDK Developers
i have information google bug in admob by google. will i get a reward for that?

Pada hari Senin, 27 Juni 2011 06:43:40 UTC + 7, Mark Carter menulis:
Saya menggunakan solusi yang dijelaskan oleh Wes, tetapi memiliki laporan dari satu pengguna bahwa bug masih terjadi:

Atrix 4g
Tingkat SDK: 8
MB860
GingerBlur 4.5
Reply all
Reply to author
Forward
0 new messages