按照以下说明,我根据铬46(标签46.0.2490.71)编译,安装并成功运行了我的自定义webview:
https://www.chromium.org/developers/how-tos/android-build-instructions
并构建了忍者目标“system_webview_apk”。
它很棒!
现在我正在尝试将它集成到基于从AOSP构建的lolipop 5.1.1_r29的自定义android映像中。 构建和安装步骤有效,但是当应用程序试图给webview充气时,我有以下错误:
E/AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unsupported ABI: null
at dalvik.system.VMRuntime.getInstructionSet(VMRuntime.java:324)
at dalvik.system.VMRuntime.is64BitAbi(VMRuntime.java:337)
at android.webkit.WebViewFactory.getWebViewNativeLibraryPaths(WebViewFactory.java:286)
(帖子末尾的完整堆栈跟踪)
奇怪的是,如果我使用完全相同的APK,并使用ADB安装它:
adb shell stop
adb pull /system/app/webview/webview.apk
adb shell rm -rf /system/app/webview/
adb shell start
adb install webview.apk
然后错误消失并且webview正确显示。
接下来,如果我再次将它放回/ system / app:
adb uninstall com.android.webview
adb push webview.apk /system/app/webview/webview.apk
adb shell stop
adb shell start
它再次失败并出现同样的错误。
我对“不支持的ABI:null”的调查只给了我这个: https://code.google.com/p/chromium/issues/detail?id=559720
但它似乎并不相关。
我需要在Android 5.1.1上基于chrome 46(至少)的webview。
任何帮助,线索或建议将不胜感激:)
关于nexus 6:
root@shamu:/ # ll /system/lib/libwebv*
-rw-r--r-- root root 31282132 2008-04-15 23:40 libwebviewchromium.so
-rw-r--r-- root root 5376 2015-12-09 15:51 libwebviewchromium_loader.so
-rw-r--r-- root root 9532 2015-12-09 15:51 libwebviewchromium_plat_support.so
Chromium构建配置:
$ cat chromium.gyp_env
{ 'GYP_DEFINES': 'target_arch=arm OS=android', }
$ cat .gclient
solutions = [
{ "name" : "src",
"url" : "https://chromium.googlesource.com/chromium/src.git",
"deps_file" : "DEPS",
"managed" : False,
"custom_deps" : {
},
"safesync_url": "",
},
]
cache_dir = None
target_os = ["android"]
完整堆栈跟踪:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webviewui/com.example.webviewui.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.example.webviewui.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.example.webviewui.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IllegalArgumentException: Unsupported ABI: null
at dalvik.system.VMRuntime.getInstructionSet(VMRuntime.java:324)
at dalvik.system.VMRuntime.is64BitAbi(VMRuntime.java:337)
at android.webkit.WebViewFactory.getWebViewNativeLibraryPaths(WebViewFactory.java:286)
at android.webkit.WebViewFactory.loadNativeLibrary(WebViewFactory.java:397)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:103)
at android.webkit.WebView.getFactory(WebView.java:2194)
at android.webkit.WebView.ensureProviderCreated(WebView.java:2189)
at android.webkit.WebView.setOverScrollMode(WebView.java:2248)
at android.view.View.<init>(View.java:3588)
at android.view.View.<init>(View.java:3682)
at android.view.ViewGroup.<init>(ViewGroup.java:497)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
at android.webkit.WebView.<init>(WebView.java:544)
at android.webkit.WebView.<init>(WebView.java:489)
at android.webkit.WebView.<init>(WebView.java:472)
at android.webkit.WebView.<init>(WebView.java:459)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
at android.app.Activity.setContentView(Activity.java:2145)
at com.example.webviewui.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
答案 0 :(得分:2)
在编译WebView for arm时,Chromium(64.0.3282.134,可能还有其他版本)将以armv7为目标。这导致将本机库放在apk中的armeabi-v7a文件夹下。当这个安装在我的示例armv7 Android 5.1.1设备上时,Android将运行dex2opt来处理apk。这样做它将在armeabi文件夹下查找本机库,而不是armeabi-v7a文件夹。因此,它永远不会找到库,并且在启动WebView时它会失败。
Chromium的消息来源有评论说它不再支持armeabi,因此建立它似乎不可行。我确实尝试显式构建arm版本6并命中编译失败。
我发现的解决方法是:
armeabi-v7a
重命名为armeabi
zipalign
和apksigner
准备安装apk 这样做我发现Android 5.1.1设备能够找到本机库并在启动WebView时使用它们。
答案 1 :(得分:0)
只需将APK推送到 / system / app / ,即无法安装系统应用。并且将其本机库复制到 / system / lib / 还不够。您还必须在 /data/system/packages.xml 文件中创建相关条目,并将 primaryCpuAbi 设置为 arm 。
答案 2 :(得分:0)
此问题与32/64位设备之间的不匹配有关。此处的chrome.org中存在一个错误:https://bugs.chromium.org/p/chromium/issues/detail?id=559720#c2
“不支持的ABI:空”可能表示32/64位不匹配。当供应商发布OTA将64位设备从32位升级到64位Android时,我们一直看到一个问题。 PlayStore中存在一个错误,此类设备将继续获得32位WebView。那可能就是这里发生的事情。我们为此打开了一个内部错误,但我无法确定何时修复。 :(用户可以通过在“设置”中卸载WebView更新,然后在Play商店中重新更新WebView来获得正确的版本。
引用上述来源的另一条评论:
该问题应在用户下次出于任何原因运行Play商店应用后自行解决(该问题仅在自动更新期间发生,运行Play商店可修复导致其安装错误软件包的错误状态)。 / p>