Android
Workflow
- Instead of
gradlew, use./mach gradleas the wrapper. Use-pargument of gradle if you need to run in a subdirectory
Android Frontend
When working in mobile/android/fenix, mobile/android/focus-android or mobile/android/android-components directories override instructions from the top-level AGENTS.md with:
./mach lintis the recommended way to run linters and format code all in one go.- It is currently too slow to run in fast feedback loops. Run it only at the end of implementing a change (or a major piece of a bigger change), like when checking if it's ready to submit a patch.
- In case you need a faster feedback loop, you can run a subset of fast linters with
./mach gradle ktfmtFormat detekt. It is not equivalent to./mach lintand doesn't guarantee patch submission readiness. - Default to running code formatting as part of
./mach lintor with./mach gradle ktfmtFormat. Don't run./mach formatin fenix/focus-android/android-components, because it skips android formatters. - Run
./mach buildonly when new changes are pulled into the work tree, or if./mach gradle ...commands do not succeed. - Run
./mach gradle [fenix|focus|components:<component>]:assembleDebugwhen you want to verify subsequent Android frontend code changes. - Don't run
./mach testwith--auto, it doesn't work on Android frontend code changes. Instead, run it for a file/feature you're working on with: ./mach test <file-name>to run all tests in the file./mach test <directory-name>to run all tests in the directory./mach test {fenix,focus,ac,android-components,geckoview}to run all tests in the specific project