Compiling Firefox Android by yourself to use more addons

2021-03-07

Yes, very simple and... violent. It's about compiling your own copy of Fenix.

 

Updated Method #

Just download Firefox Nightly, go to settings -> about, and tap logo 5 times to enter debug mode. Then you can add your own collection in settings.

Old methods below:


Create Your Own Addon Collection #

Go to https://addons.mozilla.org/ and create a collection. Notice your user name and the collection name.

Create Your Own Addon Collection

Modify app/build.gradle #

Modify applicationId and sharedUserId to avoid conflict.

diff --git a/app/build.gradle b/app/build.gradle
index 54e1ea7b5..7c56a2f67 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -27,7 +27,7 @@ android {
     }

     defaultConfig {
-        applicationId "org.mozilla"
+        applicationId "org.mozilla.allanchain"
         minSdkVersion Config.minSdkVersion
         targetSdkVersion Config.targetSdkVersion
         versionCode 1
@@ -39,8 +39,8 @@ android {
         buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
         // This should be the "public" base URL of AMO.
         buildConfigField "String", "AMO_BASE_URL", "\"https://addons.mozilla.org\""
-        buildConfigField "String", "AMO_COLLECTION_NAME", "\"7dfae8669acc4312a65e8ba5553036\""
-        buildConfigField "String", "AMO_COLLECTION_USER", "\"mozilla\""
+        buildConfigField "String", "AMO_COLLECTION_NAME", "\"more-addons\""
+        buildConfigField "String", "AMO_COLLECTION_USER", "\"your user name / id\""
         // These add-ons should be excluded for Mozilla Online builds.
         buildConfigField "String[]", "MOZILLA_ONLINE_ADDON_EXCLUSIONS",
                 "{" +
@@ -114,7 +114,7 @@ android {
                     // fatal consequences. For example see:
                     //  - https://issuetracker.google.com/issues/36924841
                     //  - https://issuetracker.google.com/issues/36905922
-                    "sharedUserId": "org.mozilla.firefox.sharedID",
+                    "sharedUserId": "org.mozilla.firefox.allanchain.sharedID",
                     "deepLinkScheme": deepLinkSchemeValue
             ]
         }
@@ -131,7 +131,7 @@ android {
                     // fatal consequences. For example see:
                     //  - https://issuetracker.google.com/issues/36924841
                     //  - https://issuetracker.google.com/issues/36905922
-                    "sharedUserId": "org.mozilla.firefox.sharedID",
+                    "sharedUserId": "org.mozilla.firefox.allanchain.sharedID",
                     "deepLinkScheme": deepLinkSchemeValue
             ]
         }
patch

Or simply a one-liner:

sed -i -e 's/org\.mozilla"/org.mozilla.allanchain"/' -e 's/org.mozilla.firefox/org.mozilla.firefox.allanchain/g' -e 's/7dfae8669acc4312a65e8ba5553036/more-addons/' -e 's/\\"mozilla\\"/\\"Allan Chain\\"/' app/build.gradle
sh

You may also want to set local.properties and / or other properties according to fenix README. For example:

echo autosignReleaseWithDebugKey > local.properties
shell

Compile #

./gradlew app:assembleRelease
sh

You are done! 🎉 The apk is available at app\build\outputs\apk\release

Leave your comments and reactions on GitHub