MENU

Android开发常用命令

June 7, 2022 • Android

最上层Activity

Linux

adb shell dumpsys activity | grep "mFocusedActivity"

Windows

adb shell dumpsys activity | findstr "mFocusedActivity"
adb shell dumpsys activity | findstr "mResumedActivity"

查看apk签名

keytool -printcert -file META-INF/CERT.RSA

查看所有Alarm

adb shell dumpsys alarm

查看所有Services

adb shell dumpsys activity services

查看应用内存信息

adb shell dumpsys meminfo "com.xxx.pkgname"

发送广播(附带参数)

adb shell am broadcast -a "android.intent.action.BOOT_COMPLETED" --ei badge_count 999

输入文本

adb shell input text "content"

模拟返回键

adb shell input keyevent 4

模拟菜单键

adb shell input keyevent 82

设置默认屏

fastboot oem select-display-panel hdmi

截屏

adb shell screencap -p /sdcard/screen.png

更改屏幕密度

adb shell wm density 360

img转换

out/host/linux-x86/bin/simg2img out/target/product/xxxx/system.img raw_system.img

开启关闭Wifi

adb shell svc wifi enable/disable

查看屏幕信息

adb shell dumpsys window displays

编译源码

source build/envsetup.sh
lunch msm8996-userdebug
jack-admin stop-server
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
jack-admin start-server
make -j8