How can I get more information about monochrome apk?

536 views
Skip to first unread message

steven zhu

unread,
Jul 24, 2019, 2:02:27 AM7/24/19
to Chromium-dev
Dear:
        I found that chromium v74 could build as monochrome.apk, and it looks like chrome as a browser, event if I change the webviewprovider package name  to "org.chromium.chrome", it will be a webview shell instead of the android webview;
        Is there any more information or docs about monochrome?I'm looking for information to describe the architecture.

Thanks~

Egor Pasko

unread,
Jul 24, 2019, 11:00:43 AM7/24/19
to zlin...@gmail.com, Chromium-dev
Monochrome is 'just' a way to share native code between Chrome and WebView implementation to save space on Android devices. A few docs mention it, like:

[1] Shared Libraries on Android

[2] Chrome and the 2MiB RELRO blob
 
Thanks~

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/8fa0814c-1900-4354-a814-4c3d46ab01ba%40chromium.org.

Torne (Richard Coles)

unread,
Jul 24, 2019, 12:12:26 PM7/24/19
to Egor Pasko, zlin...@gmail.com, Chromium-dev
As Egor says, Monochrome just combines the Chromium browser with the Chromium-based Android WebView implementation into a single binary. Both Chrome and WebView are supposed to behave exactly the same in Monochrome, so there won't be any observable difference compared to using them separately.

If you're building an Android/AOSP device ROM (either for a new device or a custom ROM for an existing device) then Monochrome might be useful to you, if you intend to ship a Chromium-based browser in the system image, to save space. I recently wrote some documentation intended for people who are building AOSP system images and want to know what to do about WebView, which you can find here: https://chromium.googlesource.com/chromium/src/+/master/android_webview/docs/aosp-system-integration.md - if this is what you're doing, then you should definitely read this and give us feedback on whether it helps you, as it's new :)

If that's not what you're trying to do, and you're just building Chromium as a browser, or trying to build a WebView into a specific app, or something similar, Monochrome is not relevant, and you can safely ignore it and just use the regular build targets. It has no benefits (and is much larger) in any other case.

steven zhu

unread,
Jul 25, 2019, 4:18:10 AM7/25/19
to Chromium-dev, pa...@google.com, zlin...@gmail.com
Thans for Egor and Torne`s reply.

In  AOSP project, only webview.apk is provided, so I can not change any code. What we did before was get the source code from chromium-project and build systemwebview apk, then replace the original webview. 

Now I just want to build a module on AOSP to implement the browser and WebView base on Chromium-project to to replace the native WebView and my web browser.Monochrome is the right project for me.

About Trichrome, I do not quite understand "TrichromeLib apk", is it like monochrome apk contains a chromium browser and a webview? 

If I want to implement my plan on androidQ+, should I turn to Trichrome?


在 2019年7月25日星期四 UTC+8上午12:12:26,Torne (Richard Coles)写道:
As Egor says, Monochrome just combines the Chromium browser with the Chromium-based Android WebView implementation into a single binary. Both Chrome and WebView are supposed to behave exactly the same in Monochrome, so there won't be any observable difference compared to using them separately.

If you're building an Android/AOSP device ROM (either for a new device or a custom ROM for an existing device) then Monochrome might be useful to you, if you intend to ship a Chromium-based browser in the system image, to save space. I recently wrote some documentation intended for people who are building AOSP system images and want to know what to do about WebView, which you can find here: https://chromium.googlesource.com/chromium/src/+/master/android_webview/docs/aosp-system-integration.md - if this is what you're doing, then you should definitely read this and give us feedback on whether it helps you, as it's new :)

If that's not what you're trying to do, and you're just building Chromium as a browser, or trying to build a WebView into a specific app, or something similar, Monochrome is not relevant, and you can safely ignore it and just use the regular build targets. It has no benefits (and is much larger) in any other case.

On Wed, 24 Jul 2019 at 10:59, Egor Pasko <pa...@chromium.org> wrote:
On Wed, Jul 24, 2019 at 8:02 AM steven zhu <zlin...@gmail.com> wrote:
Dear:
        I found that chromium v74 could build as monochrome.apk, and it looks like chrome as a browser, event if I change the webviewprovider package name  to "org.chromium.chrome", it will be a webview shell instead of the android webview;
        Is there any more information or docs about monochrome?I'm looking for information to describe the architecture.

Monochrome is 'just' a way to share native code between Chrome and WebView implementation to save space on Android devices. A few docs mention it, like:

[1] Shared Libraries on Android

[2] Chrome and the 2MiB RELRO blob
 
Thanks~

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromi...@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromi...@chromium.org.

Torne (Richard Coles)

unread,
Jul 25, 2019, 1:29:17 PM7/25/19
to zlin...@gmail.com, Chromium-dev, Egor Pasko
On Thu, 25 Jul 2019 at 04:18, steven zhu <zlin...@gmail.com> wrote:
Thans for Egor and Torne`s reply.

In  AOSP project, only webview.apk is provided, so I can not change any code. What we did before was get the source code from chromium-project and build systemwebview apk, then replace the original webview. 

Yes - that is what we expect people to do to build their own WebView. The prebuilt APK is not intended to actually be used, it's just there so that AOSP works out of the box for development/testing purposes. For actually shipping a ROM image you are supposed to build your own from a current stable version, and keep it up to date.
 
Now I just want to build a module on AOSP to implement the browser and WebView base on Chromium-project to to replace the native WebView and my web browser.

You can't really build WebView/chromium inside AOSP - we used to support this a long time ago but it was removed. The two projects use totally different build systems and have different branching models and release cycles. Whatever version of Chromium you end up building, you should just build it in a Chromium checkout and copy the built APKs into AOSP.
 
Monochrome is the right project for me.

Possibly, but please carefully read the entire guide that I linked to previously. Monochrome is a complex and somewhat fragile setup that has caused us various problems in the past, which is why it has now been replaced by Trichrome. If you want your users to be able to choose to use a different browser (e.g. allowing them to disable your Chromium-based preinstalled browser) you need to take a number of special steps to set up an alternative way to provide and update WebView for those users. Google's builds of Android do this but it's not currently well-documented and the required build targets are not all in the public source code unfortunately. You'd want to talk to us about exactly what your plans are here once you've read the guide and considered your options.

https://groups.google.com/a/chromium.org/forum/#!forum/android-webview-dev is also the best mailing list to ask that kind of question.
 
About Trichrome, I do not quite understand "TrichromeLib apk", is it like monochrome apk contains a chromium browser and a webview? 

The TrichromeLibrary.apk contains the common code that TrichromeChrome and TrichromeWebView share. The result is that TrichromeChrome and TrichromeWebView are fairly small, as most of their code is in the library. This arrangement works better than Monochrome for a number of reasons, primarily that it requires fewer special cases in the framework as Chrome and WebView continue to be separate applications from the user and system's point of view.
 
If I want to implement my plan on androidQ+, should I turn to Trichrome?

Monochrome is not supported on Q+, so if you intend to build for Q you would need to use Trichrome instead, yes. We've not yet fully publicly launched Trichrome (it's included in current Q betas but is not yet being updated via Play) and the documentation is still in the process of being finalised - again, you would likely need to talk with us about your plans.

Also, you need to bear in mind another point mentioned in the guide: it's not currently possible to build a Q-compatible version of WebView/Monochrome/Trichrome at all using open source code, and it won't be until Q is released to the public and we've had time to publish the Q-specific changes to the open source repository. So, right now building Trichrome won't help you - the version for P was only for testing and is not actually suitable for production (and will be deleted in the near future), and you can't build the version for Q yet.
 
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/c6f9f3a5-9ce6-4316-8e44-1563801d64b0%40chromium.org.

steven zhu

unread,
Jul 30, 2019, 3:07:28 AM7/30/19
to Chromium-dev, zlin...@gmail.com, pa...@google.com
Thanks Torne. I decided to give up monochrome after discussing it with my team.
For AndroidQ, keep it as it is.
For trichrome, I need to devote more time to understanding.What advice do you have on this?What can I do first based on chromium source code?

Thanks.

Torne (Richard Coles)

unread,
Aug 2, 2019, 2:10:55 PM8/2/19
to zlin...@gmail.com, Chromium-dev, Egor Pasko
On Tue, 30 Jul 2019 at 03:07, steven zhu <zlin...@gmail.com> wrote:
Thanks Torne. I decided to give up monochrome after discussing it with my team.
For AndroidQ, keep it as it is.
For trichrome, I need to devote more time to understanding.What advice do you have on this?What can I do first based on chromium source code?

The documentation I linked to is all the information out there about Trichrome at present. We've not yet upstreamed the Q support for Chromium, so right now you can't build a useful version of Trichrome anyway: you'd have to wait until we publish Q support.
 
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/c285ecd4-50e0-4590-8c76-be2445600ad3%40chromium.org.
Reply all
Reply to author
Forward
0 new messages