Aller au contenu

Cette page n'est pas encore traduite. Elle s'affiche en anglais.

Android build targets

Every android-* build target Elide registers, what each runs and writes, the options they take, and how elide run, elide test and elide mcp map onto them.

Lire hors ligneelide help --lang fr android-targets

Sur cette page

Every step of an Android build, and every device action, is a build target. elide run, elide test --device and the android/* agent tools run these targets, and elide build <target> runs any of them directly. List them, with their options, without running anything:

Terminal
bash
elide build --inspect
elide build android-run-app --help

In the names below, <a> is an application artifact, <l> a library, <b> a bundle, <x> any of them, <d> a device from android.devices, and <t> a test source set.

Building

TargetRunsWrites
android-sdksdkmanagerThe lockfile’s SDK record
android-libraries—Unpacked .aars under .dev/android/libraries/
android-resources-<x>aapt2 compileCompiled resources
android-manifest-<x>—The merged AndroidManifest.xml
android-link-<x>aapt2 linkresources.apk and R.java
android-r-<x>javacCompiled R classes
android-dex-<a>d8classes*.dex
android-r8-<a>R8, in place of d8 when minifiedclasses*.dex, mapping.txt
android-mapping-<a>—.dev/artifacts/<a>-mapping.txt
android-package-<a>—The unaligned APK
android-align-<a>zipalign -P 16The aligned APK
android-signing-<a>keytoolThe debug keystore, when it is missing
android-sign-<a>apksignerThe signed APK
android-classes-<l>—The library’s classes.jar
android-module-<b>—A bundle module zip
android-bundle-<b>bundletoolThe bundle, before signing
<a>, <l>, <b>—.dev/artifacts/<name>.{apk,aar,aab}
<a>-androidTestthe same pipelineThe instrumented test APK

Resources are linked before the code compiles, which is what makes R usable: the R classes are placed on the compile classpath of the artifact’s source sets. A build that changed nothing re-runs none of it; adding a resource re-runs the compile, the dex and the packaging. Intermediate files live under .dev/android/<x>/.

Devices

None of these is a default target: elide build alone never touches a device.

TargetDoes
android-run-<a>Install and launch on --device, the one attached device, or the project’s emulator
android-run-device-<a>The same, on a physical device only
android-run-emulator-<a>The same, on the project’s emulator, booted or reused
android-debug-<a>Launch suspended and forward JDWP
android-test-<a>Run instrumented tests
android-test-<a>-on-<d>Run them on a declared test device
android-test-<a>-on-allRun them on every declared test device
android-emulatorBoot the project’s AVD and wait for it
android-emulator-stopStop the emulator running the project’s AVD
android-avdCreate or repair the AVD without booting it
android-keystore-<a>Create the keystore signing names

Run and debug targets exist only for a signed APK, and debug targets only for a debuggable one. android-avd, android-emulator and android-emulator-stop are one per project, registered when it has a signed APK.

Host tests

Ahead of each test source set’s run, one artifact is linked again with the test libraries (Android tests):

TargetWrites
android-resources-<a>-<t>The artifact’s and every library’s resources, compiled
android-manifest-<a>-<t>The manifest, merged with test libraries’ too
android-link-<a>-<t>, android-r-<a>-<t>resources.apk and R for every package
android-host-test-<a>-<t>The resource APK, assets and the Robolectric test configuration

Options

OptionTargetsEffect
--device=<serial>run, debug, testUse that attached device.
--device=<serial>android-emulator-stopStop that emulator.
--emulatordebug, testUse the project’s emulator, booting it if needed.
--window, --no-windowanything that boots an emulatorShow the window or run headless.
--no-followrun, debugReturn once launched instead of following the log.
--debug[=<port>]debugThe local JDWP port; a free one when bare.
--tests=<class>[#<method>]testTests to run; repeatable or comma-separated.
--install-sdkanyInstall missing SDK components, accepting their licenses.
--releaseandroid-keystore-<a>Create a release keystore (Signing and release).

Options are not part of a target’s cache key, except --release.

Commands and their targets

CommandTarget
elide run [app]android-run-<app>
elide run --emulatorandroid-run-emulator-<app>
elide run --debugger[=<port>]android-debug-<app> [--debug=<port>]
elide test --device[=<serial>]android-test-<app> [--device=<serial>]
elide test --device=<d>android-test-<app>-on-<d>
elide test --device=allandroid-test-<app>-on-all
elide installandroid-sdk, installing; then android-libraries and android-r-<x> for the editor classpath
elide build --releaseEvery application, as a release build (Signing and release)

Cette page vous a-t-elle aidé ?