How to change webview into Google webview in android 7.1.1. I have only the android webview option in development mode, not the Google webview.
I was planning to use xposed to replace, but unfortunately it is not valid in android7.11. There may be a change to the android source code.
The following code:
package com.stardust.autojs.xposed.webview;
import android.content.pm.PackageInfo;
import android.content.res.XResources;
import android.os.Build;
import android.webkit.WebView;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
/**
* 替换资源WEBVIEW
*/
public class WebViewReplaceHook implements IXposedHookZygoteInit {
// public static boolean isReplaceWebView = false;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
// isReplaceWebView = true;
try{
XResources.setSystemWideReplacement("android", "string", "config_webViewPackageName", "com.google.android.webview");
}catch (Exception e){
}
findAndHookMethod("android.webkit.WebViewFactory", null, "getWebViewPackageName", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("getWebViewPackageName");
param.setResult("com.google.android.webview");
}
});
}
}
Aucun commentaire:
Enregistrer un commentaire