nix-community / robotnix

Build Android (AOSP) using Nix [maintainer=@danielfullmer,@Atemu]
625 stars 69 forks source link

[How to] Add a prebuilt Browser + WebView #202

Open NiklasGollenstede opened 1 year ago

NiklasGollenstede commented 1 year ago

First, props for your efforts! I use robotnix to build LineageOS 19.1 for a OnePlus 8, and overall that is working quite well.

Building the browsers, however, takes quite long, and keeping them up to date is apparently significant work (robotnix currently has the instructions for chrome v100. I tried updating to 108, moved past the first few errors, but now the build fails asking me to run gclient sync -- I don't even want to know what that would be good for -.-).

So, how does one add a browser and webview obtained as an APK/... from elsewhere?

I first tried this:

{ apps.prebuilt.bromite.apk = lib.mkForce (pkgs.fetchurl (lib.importJSON "..._ChromePublic.apk.json"));
  webview.bromite.apk       = lib.mkForce (pkgs.fetchurl (lib.importJSON "..._SystemWebView.apk.json"));
  build.bromite = null; apps.prebuilt.bromiteTrichromeLibrary.apk = null;

with a script that updates those .json files.

The build succeeds, does not build chrome/bromite, the output is about the same size as before, and Bromite works (though it reset all configuration/tabs). But the webview does not work, breaking all kinds of apps.

It seems to be installed, but is not selectable (Settings > System > Developer options > WebView implementation is "None" and there are no entries selectable. I was also unable to install the bromite webview. After adding the repo, the bromite webview entry in f-droid did not have an "install" button.

Then I tried disabling all webview options. The build again succeeded, the output was smaller by about the size of the webview, and the webview was installable from f-droid.

The result is still the same, though. Still no webview available. Installing Chrome WebView from the Play Store fails because the tricrome-library-thing is missing.

eyJhb commented 7 months ago

AFAIK the webview.prebuild.apk should point to a prebuild apk, such as https://github.com/LineageOS/android_external_chromium-webview_prebuilt_arm64 (webview.apk, keep in mind it's a LFS enabled git repo, so you need to fetch the correct file).

Not sure this helps you, given it's quite a while since you tried :)