Still waiting for a fix for the AdView Exceptions in 4.1.0

332 views
Skip to first unread message

William Ferguson

unread,
Jul 14, 2011, 8:12:36 AM7/14/11
to Google AdMob Ads Developers
Wes, its been a couple of months now since AdMob Android 4.1.0 SDK
came out and we're still dealing with crashes thrown by the AdView.
You've said before that the developers are working on it. Are they
about done yet?

These get thrown for all versions of Android, though the example below
is from 2.3.3
As you can see, its not something that we are capable of catching or
working around, other than to switch off the AdView.

java.lang.RuntimeException: An error occured while executing
doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask
$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1088)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)
Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only
the original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:3054)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:659)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:685)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2575)
at android.view.View.invalidate(View.java:5326)
at android.webkit.WebView.invalidate(WebView.java:9459)
at android.webkit.WebView.selectionDone(WebView.java:5285)
at android.webkit.WebView.clearHelpers(WebView.java:1470)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1964)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
... 4 more
android.view.ViewRoot$CalledFromWrongThreadException: Only the
original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:3054)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:659)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:685)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2575)
at android.view.View.invalidate(View.java:5326)
at android.webkit.WebView.invalidate(WebView.java:9459)
at android.webkit.WebView.selectionDone(WebView.java:5285)
at android.webkit.WebView.clearHelpers(WebView.java:1470)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1964)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1088)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)

Eong

unread,
Jul 14, 2011, 11:56:36 AM7/14/11
to Google AdMob Ads Developers
They are busy with merging Adsense and AdMob. Maybe also busy with
killing account and deduct money... Try something else, AdMob is not
the only choice.

On 7月14日, 下午8时12分, William Ferguson <william.ferguson...@gmail.com>
wrote:

Jim

unread,
Jul 14, 2011, 1:15:03 PM7/14/11
to Google AdMob Ads Developers
Regardless of their merger, can they do a 4.1.1 release and add a
throw statement in the Asynch task so we can catch and rebuild the
AdView - maybe it can be connected to the listener and add a listener
event like "invalidAdError". We are getting about 10 of these a day -
and I don't know why and I can't really stop them. If the ads are not
valid, we can at least catch the problem, report it to AdMob and
rebuild the AdView. The FC this causes is making our users unhappy.

Thanks,
Jim

wes

unread,
Jul 14, 2011, 3:16:19 PM7/14/11
to google-adm...@googlegroups.com
William,

We're working on finalizing a 4.1.1 release right now, which should hopefully alleviate many of these Android-specific errors.  Do you have some minimally-reproducing code I could look at to investigate this error?  It's not something we've seen in testing; are you seeing it constantly in your app?

Cheers,
Wes

William Ferguson

unread,
Jul 14, 2011, 8:26:48 PM7/14/11
to Google AdMob Ads Developers
:-) Minimal code? Sure:

adView.loadAd(newAdRequest);


Wes, it's not deterministic.
I have never seen it on any of my test devices.
But I get about 1 in roughly every 20,000 Ad Requests from a range of
devices (and Android versions) out in the field.

From the stacktrace it's quite clear that a UI element is being
modified outside of the UI Thread. With access to the source code it
should be relatively easy to see how that is occurring and to put a
stop to it.

Sorry I can't be more helpful. But I don't have access to the Admob
source.

Jim

unread,
Jul 14, 2011, 11:22:00 PM7/14/11
to Google AdMob Ads Developers
Wes,

The best I can figure, this is a null value returned from the Ad, as
indicated in the line:
"android.webkit.WebView.loadDataWithBaseURL(WebView.java:1964)"

I can only guess, because as William points out, we don't have the
source code. But here are two similar errors that would lead me to
believe this.

The first set of code below produces the "c.a" error from the bottom
part of William's code, then further below is the "invalidate" error,
which is what the WebView is doing in the top portion of William's
code. It seems an AdRequest null value throws an error, it is caught
and then WebView tries to update the AdView to handle the error, but
it's in the background thread and it throws an uncaught exception.

First, this is the code for a similar error for a null pointer:

AdView adView;
AdListener adListener;
AdRequest adRequest;

onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
adView = (AdView)findViewById(R.id.adView);
adView.loadAd(adRequest);
adListener = new AdListener();
adView.setAdListener(adListener);
adListener = null;
}

also:

onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
adView = (AdView)findViewById(R.id.adView);
adView.loadAd(adRequest);
adListener = new AdListener();
adView.setAdListener(adListener);
adRequest = null;
}


Although this is not what happens in practice, if onPause/onStop/
onDestroy makes AdListener or AdRequest null while the AdView Asynch
task is running, it is effectively what happens (and an error occurs).
This is common with a configuration change, which is probably the
primary reason this error happens.

Here's the logcat which shows the error is similar, but not the same:

07-15 00:58:53.367: ERROR/AndroidRuntime(417): FATAL EXCEPTION:
AsyncTask #1
07-15 00:58:53.367: ERROR/AndroidRuntime(417):
java.lang.RuntimeException: An error occured while executing
doInBackground()
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
android.os.AsyncTask$3.done(AsyncTask.java:200)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:
273)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1068)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:561)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.lang.Thread.run(Thread.java:1096)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): Caused by:
java.lang.NullPointerException
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at c.a(Unknown
Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at c.a(Unknown
Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
c.doInBackground(Unknown Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
android.os.AsyncTask$2.call(AsyncTask.java:185)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): ... 4 more

Here is the "invalidate" portion:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adView = (AdView)findViewById(R.id.adView);
// relative layout with adview in it
adLayout = (RelativeLayout)findViewById(R.id.adLayout);
Thread getAdThread = new Thread(null, killAd, "Kill Ad");
adHandlerThread.start();
}

private Runnable killAd = new Runnable() {
@Override
public void run () {
adLayout.setVisibility(View.INVISIBLE);
}
};

07-15 03:03:46.426: ERROR/AndroidRuntime(1204): android.view.ViewRoot
$CalledFromWrongThreadException: Only the original thread that created
a view hierarchy can touch its views.
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.checkThread(ViewRoot.java:2802)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.invalidateChild(ViewRoot.java:607)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:633)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewGroup.invalidateChild(ViewGroup.java:2505)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.invalidate(View.java:5139)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.setFlags(View.java:4516)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.setVisibility(View.java:3030)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
com.secondphoneapps.SpaLocationJumperFree.SpaLocHome
$5.run(SpaLocHome.java:243)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
java.lang.Thread.run(Thread.java:1096)

Hope that helps. We would really like this fixed.

-Jim

Máté Rémiás

unread,
Jul 15, 2011, 4:59:43 AM7/15/11
to google-adm...@googlegroups.com
I see an other error, this happens also ~once in 10.000 requests, I myself couldn't ever reproduce it. is there a way to fix it also in the next release?

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@46486818
at android.graphics.Canvas.throwIfRecycled(Canvas.java:955)
at android.graphics.Canvas.drawBitmap(Canvas.java:1044)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:323)
at android.widget.ImageView.onDraw(ImageView.java:923)
at android.view.View.draw(View.java:6739)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.view.View.buildDrawingCache(View.java:6501)
at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1261)
at android.view.ViewGroup.drawChild(ViewGroup.java:1507)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1394)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
at android.view.ViewRoot.draw(ViewRoot.java:1422)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)


-----------------------------------

an other nice and even rare piece of error is the following:

java.util.concurrent.RejectedExecutionException
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1464)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:381)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:865)
at android.os.AsyncTask.execute(AsyncTask.java:394)
at c.onProgressUpdate(Unknown Source)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:431)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)

----------------------------------

I would also suggest fixing this one:

android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1809)
at android.webkit.WebViewDatabase.removeCache(WebViewDatabase.java:832)
at android.webkit.CacheManager.getCacheFile(CacheManager.java:352)
at android.webkit.LoadListener.checkCache(LoadListener.java:758)
at android.webkit.FrameLoader.handleCache(FrameLoader.java:335)
at android.webkit.FrameLoader.handleHTTPLoad(FrameLoader.java:218)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:124)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)

thanks in advance :)

William Ferguson

unread,
Jul 15, 2011, 5:17:50 AM7/15/11
to Google AdMob Ads Developers
Mate, I think you've got zero chance of Admob being able to fix the
3rd of your Exceptions.
That looks like its solely down to a version of Webkit, or some kind
of device failure.

What makes you think the 1st stacktrace is related to Admob?


William
Reply all
Reply to author
Forward
0 new messages