Closed Bug 1891159 Opened 11 months ago Closed 5 months ago

Building Android projects from the CLI should not require Android Studio to be installed/setup

Categories

(Fenix :: Tooling, defect, P2)

All
Android
defect

Tracking

(firefox133 fixed)

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: jonalmeida, Assigned: adhingra, NeedInfo)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Whiteboard: [fxdroid][group3])

Attachments

(1 file)

Today, Gecko developers need to go through quite a few steps still to build Fenix locally if they make platform changes and want to test them out on mobile apps.

Steps to reproduce

  1. mach build
  2. Setup JAVA_HOME and ANDROID_HOME environment variables (because these cannot be found unless you use mach gradle).
  3. Generate a signing key (with CLI instructions are probably somewhere close to that link).
  4. Add autosignReleaseWithDebugKey to mobile/android/{android_app}/local.properties.
  5. cd mobile/android/fenix
  6. ./gradlew installFenixRelease

Expected behaviour

  • After mach build, you should be able to build (from the root or project directory) any of the mobile projects without needing more environment configurations outside of mach bootstrap.
  • You should not need to do step 2, 3, or 5.
  • At step 6, you should be able to use mach gradle installFenixRelease instead.

Device information

  • Firefox version: n/a
  • Android device model: n/a
  • Android OS version: n/a

Any additional information?

  • ANDROID_HOME is needed because the sdk.dir property in local.properties is created by Android Studio.
  • JAVA_HOME is needed if you are going to execute gradlew in one of the app projects.
  • Both of the above would not need to be set if we can get mach gradle to recognize these projects from the root gradle.

This might be a solved problem if bug 1891130 is fixed, but it's not clear if there are more issues that will turn up after that, so filing this for now.

Bug 1884675 might be a possible duplicate.

See Also: → 1884675
Depends on: 1888358

The severity field is not set for this bug.
:bclark, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(brclark)
Priority: -- → P2
Severity: -- → S3
Blocks: 1884675
No longer blocks: 1884675
Component: General → Tooling
Assignee: nobody → adhingra
Status: NEW → ASSIGNED
Pushed by pmceldowney@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/26ed437e3b77 Add mach support for installFenixRelease. r=nalexander,geckoview-reviewers,pollymce,ohall
Whiteboard: [fxdroid][group3]
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch

Just wanted to add a note here about the landed patch:

This patch adds the command: mach install --app=org.mozilla.fenix.release which replaces steps, 2, 5, 6. Steps 1, 3 and 4 still need to be done before running this command as defined in the description! I don't have any ideas on how to add step 3 to this flow right now but please feel free to reopen this bug and change the priority if needed! Thanks!

Flags: needinfo?(jonalmeida942)

(In reply to Aaditya Dhingra [:adhingra] from comment #7)

Just wanted to add a note here about the landed patch:

This patch adds the command: mach install --app=org.mozilla.fenix.release which replaces steps, 2, 5, 6. Steps 1, 3 and 4 still need to be done before running this command as defined in the description! I don't have any ideas on how to add step 3 to this flow right now but please feel free to reopen this bug and change the priority if needed! Thanks!

Surely it's possible to generate local keys as part of mach build (or perhaps mach bootstrap), and then use them during the (Gradle) build when required. We did this ages ago, pre-Gradle, using some manual keychain. You might want to mark the generated keys as "debug" keys, so that you can install with them across different devices.

(In reply to Nick Alexander :nalexander [he/him] from comment #8)

Surely it's possible to generate local keys as part of mach build (or perhaps mach bootstrap), and then use them during the (Gradle) build when required. We did this ages ago, pre-Gradle, using some manual keychain. You might want to mark the generated keys as "debug" keys, so that you can install with them across different devices.

Specifically, I think it was this script that is no longer in central (but still in our esr68/fennec branch), but could give you the hints you need: https://searchfox.org/mozilla-esr68/source/mobile/android/debug_sign_tool.py

Flags: needinfo?(jonalmeida942)

First thank you for adding this feature. Beside that I have one question:

Why do we actually have to specify release or debug? Cannot we retrieve it from the mozconfig settings? A build can only be release or debug so maybe we could just use mach install --app=org.mozilla.fenix and it will automatically pick-up the correct build? Happy to file a follow-up bug if that makes sense.

Aaditya, maybe you can have a look at my last comment with questions? Thanks.

Flags: needinfo?(adhingra)

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #10)

First thank you for adding this feature. Beside that I have one question:

Why do we actually have to specify release or debug? Cannot we retrieve it from the mozconfig settings? A build can only be release or debug so maybe we could just use mach install --app=org.mozilla.fenix and it will automatically pick-up the correct build? Happy to file a follow-up bug if that makes sense.

Hey, I apologize, I missed this comment before! I wasn't aware that this was an option or that "a build can only be release or debug". I will surely look into it now! Please feel free to file a follow up bug for this! Thanks!

Flags: needinfo?(adhingra)
Duplicate of this bug: 1830695
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: