我启动了一个具有 android 原生 webView(android.webkit.WebView) 的 Activity,但在 64 位设备中出现以下错误。
error instantiating provider java.lang.RuntimeException: Cannot load WebView
at org.chromium.android_webview.AwBrowserProcess.loadLibrary(AwBrowserProcess.java:52)
Caused by: org.chromium.base.library_loader.ProcessInitException
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.android.webview-1/lib/arm/libwebviewchromium.so" is 32-bit instead of 64-bit
请提供一些宝贵的建议。
最佳答案
我刚刚在设备场中的远程设备上运行测试时遇到了同样的错误。这是一台运行 Android 6 的 Samsung S6 设备。我认为两者都不是特别具体,这个问题很可能发生在各种设备和操作系统版本上。
我们的自动化测试因同样的错误而失败:
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.android.webview-1/lib/arm/libwebviewchromium.so" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary(Runtime.java:372)
这些错误已经发生好几天了。我设法以交互方式连接到设备,但发现我们的应用无法在其上启动。然后我检查了 Google Play,发现有各种更新待处理,包括 Android System WebView 的更新,最后一次更新是在 31 周前。
我决定更新那一项,然后再次尝试运行我们的应用程序。我们的应用程序现在可以运行了。
线索是上面@Ironman 提供的链接中的讨论
https://bugs.chromium.org/p/chromium/issues/detail?id=547842其中包括一个已从 32 位操作系统升级到 64 位操作系统的设备,但不知何故 Google Play 仍在发送 WebView 的 32 位二进制文件。无论如何...关键是问题与 WebView 组件的旧的、不正确的二进制版本有关。
顺便说一句,我认为当我们在应用程序的 gradle 配置中更新各种组件和 gradle 时,问题就出现了。 https://github.com/kiwix/kiwix-android/commit/1e03a4ae72f8fe5a9a133913e110add7f3a37631
04-12 17:40:09.605 7979 7979 E dex2oat : Failed to create oat file: /data/dalvik-cache/arm64/data@app@com.google.android.webview-1@base.apk@classes.dex: Permission denied
04-12 17:40:09.615 7946 7946 W art : Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.google.android.webview-1/base.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.google.android.webview-1@base.apk@classes.dex) because non-0 exit status
04-12 17:40:09.715 7946 7946 E cr_LibraryLoader: Unable to load library: webviewchromium
04-12 17:40:09.715 7946 7946 E WebViewFactory: error instantiating provider
04-12 17:40:09.715 7946 7946 E WebViewFactory: java.lang.reflect.InvocationTargetException
-- cut --
04-12 17:40:09.715 7946 7946 E WebViewFactory: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.android.webview-1/lib/arm/libwebviewchromium.so" is 32-bit instead of 64-bit
-- cut --
04-12 17:40:09.725 7946 7946 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.google.android.webview-1/lib/arm/libwebviewchromium.so" is 32-bit instead of 64-bit
关于android - 无法加载 WebView : java. lang.UnsatisfiedLinkError,库是 64 位而不是 32 位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38146315/