Skip to content

Instantly share code, notes, and snippets.

@dbrant
Created February 19, 2016 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrant/f222e3b38d3757f6c2b1 to your computer and use it in GitHub Desktop.
Save dbrant/f222e3b38d3757f6c2b1 to your computer and use it in GitHub Desktop.
Sketch of catching exception when WebView is being updated.
@Override
protected void onStart() {
try {
super.onStart();
} catch (Throwable t) {
if (ThrowableUtil.throwableContainsException(t, PackageManager.NameNotFoundException.class)) {
// This can happen when the system updates the WebView component. There's a
// brief window of time when the old WebView is uninstalled from the package
// manager, and the new one is not yet installed, so it literally doesn't exist.
// Comments from Chromium developers suggest that applications need to handle
// this themselves for now, until a better solution is developed in the framework.
// https://code.google.com/p/chromium/issues/detail?id=506369#c7
//L.logRemoteErrorIfProd(t);
Toast.makeText(this, R.string.error_webview_updating, Toast.LENGTH_LONG).show();
finish();
} else {
throw t;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment