"Unsupported ABI" Error in Chrome View

I compiled, installed, and successfully completed my own chrome-based web view 46 (tag 46.0.2490.71) by following these instructions:

https://www.chromium.org/developers/how-tos/android-build-instructions

and built the ninja target "system_webview_apk".

And it works great!

Now I'm trying to integrate it into my own android image based on lolipop 5.1.1_r29 built from AOSP. The build and installation steps work, but when the application tries to inflate the webview, I have the following error:

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) 

(Full stack trace at the end of the message)

It is strange that if I take the exact same APK and install it using 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 

Then the error disappears and the web view is displayed correctly.

Then, if I put it back in / system / app:

 adb uninstall com.android.webview adb push webview.apk /system/app/webview/webview.apk adb shell stop adb shell start 

Failure again with the same error.

My investigation into "Unsupported ABI: null" only gave me the following: https://code.google.com/p/chromium/issues/detail?id=559720

But that does not seem to be related.

I need chrome-based webview 46 (at least) on android 5.1.1.

Any help, hint or suggestion would be appreciated :)

Additional Information:

Relationship 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 

Chrome assembly configuration:

 $ 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"] 

Full stack trace:

  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) 
+5
source share
2 answers

When compiling the WebView for the Chromium hand (64.0.3282.134 and probably other versions) will target armv7. This leads to the installation of their own libraries in the armeabi-v7a folder in apk. When this is installed in my example, the armv7 Android 5.1.1 Android device will start dex2opt to handle apk. At the same time, he will search for native libraries in the armeabi folder, and not in the armeabi-v7a folder. Because of this, it will never find the library, and when the WebView is launched, it fails.

The source of Chromium has comments saying that it no longer supports armeabi, so making it seems unviable for this. I tried to explicitly create hand version 6 and hit a compilation failure.

The workaround I found is the following:

  • Unzip the built-in web view of Chromium
  • Rename the library folder from armeabi-v7a to armeabi
  • Replace all backups by renaming the resulting file as apk. (Note that when zipping does not compress the content, WebView expects some of its assets to not be compressed, and compressing them will cause a crash at runtime).
  • Use zipalign and apksigner to get apk ready to install
  • Install the resulting apk file

Thus, I noticed that the Android 5.1.1 device was able to find its own libraries and use them when starting WebView.

+1
source

You cannot install the system application simply by pressing the APK on / system / app / . And this is not enough for its native libraries to be copied to / system / lib / . You must also create the corresponding entry in the /data/system/packages.xml file, and primaryCpuAbi - arm .

0
source

Source: https://habr.com/ru/post/1237851/


All Articles