?? Master AOSP Utility Commands: Turbocharge Your Workflow! ??

?? Master AOSP Utility Commands: Turbocharge Your Workflow! ??

If you're an AOSP developer, these utility commands are your best friends! They streamline debugging, building, and managing code, letting you focus on creating amazing solutions. Whether you're working on the core Android platform or custom Android Automotive solutions, these commands are indispensable.

Here are 10+ examples that can save you time and effort:


?? 1. lunch

Set up your build environment.

lunch aosp_<device>-userdebug
        

Example:

lunch aosp_<device>-userdebug        

This preps your build system for an Android emulator or device-specific build.


?? 2. repo

Manage multiple repositories easily:

  • Initialize your repo:

repo init -u https://android.googlesource.com/platform/manifest -b master        

  • Sync your codebase (parallel threads):

repo sync -j16        

?? 3. m / mm / mmm

  • Build the whole system:

m droid        

  • Rebuild a specific module from anywhere:

mmm frameworks/base        

  • Build only what's in the current directory:

mm        

?? 4. adb (Android Debug Bridge)

Interact with your device or emulator:

  • Forward a port for debugging:

adb forward tcp:9222 localabstract:webview_devtools_remote        

  • Take a screenshot:

adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png        

  • Record a video:

adb shell screenrecord /sdcard/demo.mp4
adb pull /sdcard/demo.mp4        

?? 5. fastboot

Critical for flashing and debugging:

  • Flash the system image:

fastboot flash system system.img
        

  • Reboot into recovery mode:

fastboot reboot recovery        

?? 6. dumpsys

A goldmine for inspecting system services:

  • Analyze app memory usage:

adb shell dumpsys meminfo com.example.myapp        

  • Check battery stats:

adb shell dumpsys battery        

  • Display current running activities:

adb shell dumpsys activity activities        

?? 7. logcat

Real-time system logging made easy:

  • Filter logs by tag:

adb logcat MyAppTag:D *:S
        

  • Save logs to a file:

adb logcat > logs.txt        

?? 8. aapt (Android Asset Packaging Tool)

For inspecting APKs and resources:

  • List contents of an APK:

aapt list -v myapp.apk        

  • Dump APK information:

aapt dump badging myapp.apk        

?? 9. emulator

Launch and customize Android emulators:

  • Start a specific AVD (Android Virtual Device):

emulator -avd Pixel_4_API_30        

  • Run with GPU acceleration:

emulator -avd Pixel_4_API_30 -gpu host        

?? 10. perfetto

System tracing for performance profiling:

  • Start a system trace:

adb shell perfetto --config=/data/misc/perfetto/config.pb --out=/data/misc/perfetto/trace_output
adb pull /data/misc/perfetto/trace_output        

?? 11. gdbclient

Debug native code with gdb:

  • Attach to a process:

gdbclient app_process        

?? 12. traceview

Visualize execution times:

  • Generate a traceview from a method trace file:

traceview trace.trace        

#AndroidDevelopment #AOSP #AndroidAutomotive #DeveloperTools #TechTips #Programming


要查看或添加评论,请登录

Vikash Choudhary的更多文章

社区洞察

其他会员也浏览了