App is crashing while loading a url in WebView

78 views Asked by At

Hi i am trying to load a url in WebView that contains HTML. I am trying to load with

webView.loadDataWithBaseURL("", url, "text/html; charset=utf-8", "UTF-8", "");

But once this method is called, my app crashes with this exception.

:E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1110288). java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1110288 bytes

i have tried even using content providers, compressing the url and decompressing, but nothing has changed

1

There are 1 answers

2
coderAsk On

It seems the HTML content that you are trying to load , is too large hence you are getting exception java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1110288 bytes.

There are few possible ways that I can think of./

  1. First of all see, if you can reduce HTML content size, it is better to remove redundant elements from it.

  2. Instead of opening it in the app web view, can you check if you can open it in an external browser from the app itself? You can use Andriod intent functionality for this - https://developer.android.com/reference/android/content/Intent

Something this will work

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);