Skip to content

Is there a way to reduce the size of the library being used in geckoview? like the libxul.so? #244

Open

Description

@m182s

I was wndering if I can reduce the size of the library used by geckoview,
One of the biggest lib file is libxul.so, is there a way to reduce the size during building of the gecko binaries?
I tried some options in mozconfig like the following:

ac_add_options --target=i686-linux-android
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --enable-release
ac_add_options --as-milestone=release
ac_add_options --enable-official-branding
ac_add_options --with-branding=mobile/android/branding/official

currently I got libxul.so size of ~50mb inside aar file.

any ideas in reducing components and features?

Activity

  1. PSilverQ commented on Sep 23, 2025

    @PSilverQ

    Great! Your solution looks very geek ,however for most of us application developer, we don't wanna re-complie geckoview source, inadequate knowledge....
    I tried below solution, wirte here for your information.

    1.use abiFilters only package target device arch lib can reduce large size:
    (not filter)666MB -> (abiFilters "armeabi-v7a",) 143MB
    but it still huge for a web app. My app need implement auto-update and cannot use googel play bundle, it means lib will be download every time, it's such a waste.

    2.extract all geckoview lib and download and extract to app private dir and use system.load() to load all library. (failed, don't know reason yet)
    I extract all abi lib from geckoview.arr, zip these libs and upload to my static resource server. here I got a url for my app to download lib: https://myserver/geckoview/{abi}.zip.
    when app start, I do these steps:
    1.check if lib exsists in extract dir. 2.download lib zip and extract if not exists. 3.use system.load all libs 4.start geckoview after all task done.
    I thought I'll sucess, but fail to get an error:
    java.lang.RuntimeException: Could not find mozglue path. at org.mozilla.gecko.mozglue.GeckoLoader.getLibraryPath(GeckoLoader.java:204) at org.mozilla.gecko.mozglue.GeckoLoader.doLoadLibrary(GeckoLoader.java:367) at org.mozilla.gecko.mozglue.GeckoLoader.loadMozGlue(GeckoLoader.java:387) at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:477)
    anyone know what happens? seems geckoview hardcore lib load path, not use dynamic load lib.

    It would be very helpful if the official could provide a method to dynamically load lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions