An utility for testing the behavior of android_logger crate.
-
Setup
cargo-ndkcargo install cargo-ndk rustup target add x86_64-linux-android -
Build with
cargo ndk:ANDROID_NDK_HOME=/usr/lib/android-sdk/ndk/27.1.12297006 cargo ndk -t x86_64 build --release
-
Grab a Cuttlefish virtual device + Android build from Android CI. Select the last green
aosp_cf_x86_64_phonetrunk_staging-userdebugbuild and open "Artifacts" link, download:aosp_cf_x86_64_phone-img-BUILDNUMBER.zipcvd-host_package.tar.gz
-
Unpack both archives & start the emulator.
cd $(mktemp -d) unzip ~/Downloads/aosp_cf_x86_64_phone-img-*.zip tar xf ~/Downloads/cvd-host_package.tar.gz HOME=$PWD bin/launch_cvdOnce emulator launches,
adbshould detect it on0.0.0.0:6520automatically. Shut down thelaunch_cvdcommand to exit the emulator. -
Upload & run:
adb push ./target/x86_64-linux-android/release/log-test /data/local/tmp/ adb shell /data/local/tmp/log-test
See logd
README
in AOSP for details.
# default: should print info+ logs in `adb logcat -s log_test`
# hint: use `adb logcat -v color` is awesome too
adb shell /data/local/tmp/log-test
# should print trace+ logs in `adb logcat -s log_test`
adb shell setprop log.tag V
adb shell /data/local/tmp/log-test
# should print warn+ logs in `adb logcat -s log_test`
adb shell setprop log.tag.log_test W
adb shell /data/local/tmp/log-test