Android webview更新记录-aosp
一、下载
webview下载地址,感谢火哥分享,版本很全。https://www.firepx.com/app/android-system-webview/
二、更新
external/chromium-webview/prebuilt具体更新那个目录,需要查看编译架构
这个看你的lunch就行,这里我的是arm64,所以我下载最新webview最新apk后更改名称覆盖即可
三、修改默认包名
frameworks/base/core/res/res/xml/config_webview_packages.xml<webviewproviders><!-- The default WebView implementation --><!-- <webviewprovider description="Android WebView" packageName="com.android.webview" availableByDefault="true"> --><webviewprovider description="Android WebView" packageName="com.google.android.webview" availableByDefault="true"></webviewprovider>
</webviewproviders>
四、编译一致性问题
编包可能会碰见可选依赖库error,导致编译失败,这里在bp文件中加入如下代码即可。相关文章
https://blog.csdn.net/dongxianfei/article/details/123665498
//
// Copyright (C) 2014 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//// Install the prebuilt webview apk.
package {default_applicable_licenses: ["external_chromium-webview_license"],
}// Added automatically by a large-scale-change
// See: http://go/android-license-faq
license {name: "external_chromium-webview_license",visibility: [":__subpackages__"],license_kinds: ["SPDX-license-identifier-Unicode-DFS",],// large-scale-change unable to identify any license_text files
}android_app_import {name: "webview",product_specific: true,default_dev_cert: true,required: ["libwebviewchromium_loader","libwebviewchromium_plat_support",],arch: {arm: {apk: "prebuilt/arm//webview.apk",},arm64: {apk: "prebuilt/arm64/webview.apk",},x86: {apk: "prebuilt/x86/webview.apk",},x86_64: {apk: "prebuilt/x86_64/webview.apk",},},//新加代码 enforce_uses_libs: false,dex_preopt: {enabled: false,},
}
五、关于特权应用使用webview报错
只要在Activity的oncreate方法中调用hook函数就行了,切记一定要** 在setContentView之前调用** ,或者在** webVIew创建之前调用** ,不然还是会报错的。相关文章
https://blog.csdn.net/TeleostNaCl/article/details/148400974
https://geekdaxue.co/read/xshawn@aosp/bfn7lq
https://blog.csdn.net/wxj280306451/article/details/106522384