Creating Chromium WebView for Android

I am trying to follow the instructions to build a webview apk from a chrome base. I am running Android 7.0 build. I finished the compilation process for chrome and created an APK. I have two questions related to the steps after generating the APK.

Firstly, the library name is different from what I expected. The default value of webview.apk is the library name libwebviewchromium.so , but the APK built with chrome ( SystemWebView.apk ) contains lib libwebviewchromium.cr.so . I wanted to ask if this could cause problems, and if others also saw it.

Secondly, I can not remove the com.android.webview application from the device. The instructions require that you remove this application and delete its folder before the new APK is installed. I get an error message:

 $ adb uninstall com.android.webview [DELETE_FAILED_INTERNAL_ERROR] 

I wanted to ask if anyone knows how to resolve this. I saw a related question and want to ask if there is another approach that does what this one offers.

+6
source share
3 answers

The following answer is related to the second part of my question.

I took the following steps to make SystemWebView.apk work (note: webview.apk was the system application in my build in /system/app ; the following steps were used to install and test SystemWebView.apk as a third-party application)

(Take a look at step 6 first to backup 2 files)

  • Firstly, I followed the related answer in adb pull and edited the packages.xml and packages.list files (I haven't clicked them yet)
  • adb shell break
  • I click two files
  • Then I deleted the following folders (basically any trace of com.android.webview ):
  /system/app/webview /data/data/com.android.webview /data/user/0/com.android.webview /data/misc/profiles/cur/0/com.android.webview /data/misc/profiles/ref/com.android.webview /data/user_de/0/com.android.webview 
  1. adb install SystemWebView.apk

  2. I also libwebviewchromium64.relro up the libwebviewchromium64.relro and libwebviewchromium32.relro from /data/misc/shared_relro/ . After installation, I noticed that for some reason these files are erased, so I copied them again (first copying to the SD card, and then moving to the shared_relro folder).

  3. start of command line

After that, I tested a simple application containing a WebView and could see the loaded web pages.

+4
source

Native web browsing has many performance and caching limitations.
I would rather suggest you a CustomTabsClient web view supported by the Chrome browser. You can get it by adding the following dependencies to your project.

 dependencies { ... compile 'com.android.support:customtabs:23.3.0' } 

Read more about visiting. https://developer.chrome.com/multidevice/android/customtabs

0
source

You need to create SystemWebView.apk with ninja -C out / Release system_webview_apk

Learn more about this page. https://chromium.googlesource.com/chromium/src/+/master/docs/android_build_instructions.md as well as https://www.chromium.org/developers/how-tos/build-instructions-android-webview

adb remove com.android.webview

fails because it is a system application, you can directly replace webview.apk in / system / app / webview / dir, after that do stop && & Start, for this you need root permission.

0
source

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


All Articles