方式1:修改系统源码
android\frameworks\base\core\java\android\webkit\WebViewFactory
@UnsupportedAppUsage
static WebViewFactoryProvider getProvider() {
synchronized (sProviderLock) {
// For now the main purpose of this function (and the factory abstraction) is to keep
// us honest and minimize usage of WebView internals when binding the proxy.
if (sProviderInstance != null) return sProviderInstance;
final int uid = android.os.Process.myUid();
if (uid == android.os.Process.ROOT_UID || uid == android.os.Process.SYSTEM_UID ||uid == android.os.Process.PHONE_UID || uid == android.os.Process.NFC_UID|| uid == android.os.Process.BLUETOOTH_UID) {
throw new UnsupportedOperationException(
"For security reasons, WebView is not allowed in privileged processes");
}
........
}
去掉其中的 uid == android.os.Process.ROOT_UID || uid == android.os.Process.SYSTEM_UID