1*7594170eSAndroid Build Coastguard WorkerInstructions for building/running the minimal apex 2*7594170eSAndroid Build Coastguard Worker 3*7594170eSAndroid Build Coastguard WorkerYou need an android device/emulator to run it on, an easy option is: 4*7594170eSAndroid Build Coastguard Worker 5*7594170eSAndroid Build Coastguard Worker``` 6*7594170eSAndroid Build Coastguard Workerlunch sdk_phone_x86_64-userdebug 7*7594170eSAndroid Build Coastguard Workerm 8*7594170eSAndroid Build Coastguard Workeremulator 9*7594170eSAndroid Build Coastguard Worker``` 10*7594170eSAndroid Build Coastguard Worker 11*7594170eSAndroid Build Coastguard WorkerTo build and install with soong: 12*7594170eSAndroid Build Coastguard Worker``` 13*7594170eSAndroid Build Coastguard Workerm build.bazel.examples.apex.minimal && adb install out/target/product/emulator_x86_64/product/apex/build.bazel.examples.apex.minimal.apex && adb reboot 14*7594170eSAndroid Build Coastguard Worker``` 15*7594170eSAndroid Build Coastguard Worker 16*7594170eSAndroid Build Coastguard WorkerTo build and install with bazel: 17*7594170eSAndroid Build Coastguard Worker``` 18*7594170eSAndroid Build Coastguard Workerb 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*7594170eSAndroid Build Coastguard Worker``` 20*7594170eSAndroid Build Coastguard Worker 21*7594170eSAndroid Build Coastguard WorkerThe first time you try to install the apex, you will probably get this error: 22*7594170eSAndroid Build Coastguard Worker 23*7594170eSAndroid Build Coastguard Worker``` 24*7594170eSAndroid Build Coastguard Workeradb: 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*7594170eSAndroid Build Coastguard Worker``` 26*7594170eSAndroid Build Coastguard Worker 27*7594170eSAndroid Build Coastguard WorkerThere'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*7594170eSAndroid Build Coastguard Worker 29*7594170eSAndroid Build Coastguard Worker``` 30*7594170eSAndroid Build Coastguard Workerm installclean 31*7594170eSAndroid Build Coastguard Workerm build.bazel.examples.apex.minimal 32*7594170eSAndroid Build Coastguard Workerm 33*7594170eSAndroid Build Coastguard Worker``` 34*7594170eSAndroid Build Coastguard Worker 35*7594170eSAndroid Build Coastguard Workerand then restarting the emulator. After you've done this once you can use the regular install commands above from then on. 36*7594170eSAndroid Build Coastguard Worker 37*7594170eSAndroid Build Coastguard WorkerTo run the binary that the apex installs: 38*7594170eSAndroid Build Coastguard Worker 39*7594170eSAndroid Build Coastguard Worker``` 40*7594170eSAndroid Build Coastguard Workeradb shell /apex/build.bazel.examples.apex.minimal/bin/build.bazel.examples.apex.cc_binary 41*7594170eSAndroid Build Coastguard Worker``` 42