简体   繁体   中英

Android Webview support TLS 1.2 pre Kitkat

Is there any possibility to support TLS 1.2 in a WebView on pre Kitkat?

I found this SO question but I wonder if anybody know an answer for it right now:

Enabling specific SSL protocols with Android WebViewClient

I've tried all the available solutions but non of the working for webview below 4.3. The solution I found would be replacing WebView with CrossWalk. downside would be increasing your apk file size by 40mb, unless you optimize it by splitting arm and x86.

in build.gradle

repositories {
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
    }
}

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.1' //optional, in case you have compile issue.
    }
}

implementation 'org.xwalk:xwalk_core_library:19.49.514.5' //latest available library for min 14 API

layout

 <org.xwalk.core.XWalkView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/web_view"/>

code

XWalkView webview = (XWalkView) findViewById(R.id.web_view);
webview.load(url,null);

Javascript and DOM storage enabled by default. Two line of codes will do the basic job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM