Essential Android Debugging and Development Commands

Measuring Aplpication Launch Time

To measure the time from process initiation to full activity rendering on screen:

adb shell am start -S -W com.example.app/.MainActivity

For API level 19 and above, use logcat with the Displayed filter.

Extracting Application Package Information

Retrieve package name and activity details from an APK:

aapt dump badging app.apk > output.txt

Checking Package Version

adb shell "dumpsys package com.example.app | grep version"

Scheduled System Shutdown

@echo off
shutdown.exe -s -t 3600
exit

Network Proxy Configuration

adb root
adb remount
adb push hosts_file /system/etc/hosts
adb shell pm clear com.example.app
adb shell am start -n com.example.app/.MainActivity

Generating System Bug Reports

Capture comprehensive system diagnostics includign recent crashes:

adb bugreport ~/output_directory

Layout Debugging

Enable visual layout boundaries:

adb shell setprop debug.layout true

Process Management

Terminate specific application processes:

adb shell am force-stop com.example.app

Screen Capture Operations

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

Log Collection and Filtering

adb shell logcat -c
adb shell logcat -v time > log_output.txt
adb shell logcat -s TAG_FILTER

Application Data Management

adb shell pm clear com.example.app

APK Signing and Verification

java -jar apksigner.jar sign --ks keystore_file --ks-key-alias alias_name --ks-pass pass:password --key-pass pass:password --out signed.apk unsigned.apk
java -jar apksigner.jar verify -v signed.apk

Activity Inspection

Identify currently focused activity:

adb shell dumpsys activity | findstr "mFocus"

System Information Retrieval

adb shell cat /system/build.prop
adb shell cat /proc/meminfo
adb shell dumpsys meminfo

Network Packet Capture

adb push tcpdump /data/local/tcpdump
adb shell chmod 6755 /data/local/tcpdump
adb shell /data/local/tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
adb pull /sdcard/capture.pcap

Signature Verification

keytool -printcert -jarfile application.apk

Memory Analysis

Examine memory usage patterns:

adb shell procrank
adb shell dumpsys cpuinfo
adb shell ps
adb shell cat /proc/pid/status

Overdraw Visualization

adb shell setprop debug.hwui.overdraw show
adb shell setprop debug.hwui.overdraw false

Broadcast Transmission

adb shell am broadcast -a com.example.action
adb shell am broadcast -a com.example.action -n com.example.app/.ReceiverClass

Hosts File Modification

adb root
adb remount
adb push custom_hosts /system/etc/hosts

Build Automation

Using make within Cygwin environment for Windows-based development.

SO Library Analysis

Gradle task to identify native library dependencies:

tasks.whenTaskAdded { task ->
    if (task.name == 'transformNativeLibsWithMergeJniLibsForRelease') {
        task.doFirst {
            fileTree(dir: it.inputs.files.singleFile).filter { it.name.endsWith('.so') }.each { lib ->
                println "Found native library: ${lib.absolutePath}"
            }
        }
    }
}

Tags: Android ADB debugging APK Signing

Posted on Mon, 01 Jun 2026 16:59:15 +0000 by thekoopa