xref: /aosp_15_r20/build/bazel/examples/apex/minimal/README.md (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
1Instructions for building/running the minimal apex
2
3You need an android device/emulator to run it on, an easy option is:
4
5```
6lunch sdk_phone_x86_64-userdebug
7m
8emulator
9```
10
11To build and install with soong:
12```
13m build.bazel.examples.apex.minimal && adb install out/target/product/emulator_x86_64/product/apex/build.bazel.examples.apex.minimal.apex && adb reboot
14```
15
16To build and install with bazel:
17```
18b build --config=android_x86_64 //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal && adb install bazel-bin/build/bazel/examples/apex/minimal/build.bazel.examples.apex.minimal.apex && adb reboot
19```
20
21The first time you try to install the apex, you will probably get this error:
22
23```
24adb: failed to install out/target/product/emulator_x86_64/product/apex/build.bazel.examples.apex.minimal.apex: Error [1] [apexd verification failed : No preinstalled apex found for package build.bazel.examples.apex.minimal]
25```
26
27There's probably better ways to resolve it, but one easy way is to take advantage of a bug (b/205632228) in soong and force it to be preinstalled by running:
28
29```
30m installclean
31m build.bazel.examples.apex.minimal
32m
33```
34
35and then restarting the emulator. After you've done this once you can use the regular install commands above from then on.
36
37To run the binary that the apex installs:
38
39```
40adb shell /apex/build.bazel.examples.apex.minimal/bin/build.bazel.examples.apex.cc_binary
41```
42