androidandroid-studioandroid-webviewandroid-4.4-kitkatodroid

Web Viewer on Android 4.4 very slow


I may be in a bit of a unique situation however I am running Android 4.4 on a rooted Odroid xu4. I have developed a very basic web viewer application for android. I have installed it onto a OnePlus 5 and it works perfectly smooth. However on the Android 4.4 device the web page is very slow and lags. I have tried to enable android hardware acceleration and that hasn't done it. I understand that 4.4 KitKat version of Android runs off of a different version of web viewer.

I dont know if a possible solution would be, to somehow, update the web viewer without updating the entire OS. (Updating the entire OS is not an option for me.)

Hope someone can help or has any suggestions, all is appreciated. Thanks


Solution

  • try this see if its work:

    add android:largeHeap="true" in your application tag in manifest

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
    

    update

    you can also add handler for a one second delay to load before show something to stop laging somehow:

     new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                wbView.loadUrl(URL);
            }
        }, 1000);
    

    you should of course add this lines too for java script webs and storage managing :

     wbView.getSettings().setJavaScriptEnabled(true);
     wbView.getSettings().setDomStorageEnabled(true);
    

    also for cookie managing:

     CookieManager.getInstance().setAcceptCookie(true);
     wbView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);