Android开发调试常用命令列表
adb命令
am
am start -n com.iflytek.autofly.account/.ui.MainActivity
am start -n com.android.settings/.Settings
am start "intent:#Intent;action=android.media.action.MEDIA_PLAY_FROM_SEARCH;\
S.android.intent.extra.focus=vnd.android.cursor.item%2Fartist;\
S.android.intent.extra.artist=Adele;end"
adb shell am start -n com.iflytek.autofly.speechclient/\
com.iflytek.autofly.settings.ui.OtherSubSettingActivity
adb shell am start -n com.iflytek.autofly.applist/.AppListMainActivity
adb shell am startservice -a com.iflytek.autofly.VoiceKey -e StartFrom HomeVoiceButton
am start "intent:#Intent;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;launchFlags=0x10200000;component=com.retton.h5/.WebActivity;S.title=%E6%97%A5%E6%9C%9F%2F%E6%97%B6%E9%97%B4;S.url=http%3A%2F%2Fwww.pingwest.com;end"
logcat
logcat | busybox grep `ps | busybox grep "com.package.name$"\
| busybox awk -F " " '{print $2}'`
logcat | busybox grep `ps | busybox grep "com.package.name$"\
| busybox awk 'NR%2==1{T=$2;next}{print T"|"$2}'
logcat | grep -E `ps |grep account| busybox awk 'NR%2==1{T=$2;next}{printf T"|"$2}'`
adb logcat -vtime -d > ~/Desktop/dump.log
其他
网络抓包命令
tcpdump -i usb0 -s0 -w /data/local/tmp/`date "+%Y%m%d%H%M%S"`.pcap
tcpdump -i usb0 -s0 -vv tcp port 80 and host hostname
monkey命令
monkey -p com.package.name --pct-syskeys 0 100000
查看包信息
dumpsys package com.test.package.name
系统命令
#打开wifi
adb shell svc wifi enable
#打开数据流量
adb shell svc data enable
#发送HOME按键事件
adb shell input keyevent HOME
#发送返回按键事件
adb shell input keyevent BACK
in gitbash:
adb push myfile //system/app/path.apk
通用
git
#删除对文件的跟踪,会修改commit id,只在本地使用
git filter-branch --tree-filter 'rm -f testme.txt' HEAD
忽略merge日志 git log --no-merges
查看从v2.6.12开始include/scsi和drivers/scsi目录中的改动的日志 git log v2.6.12.. include/scsi drivers/scsi
导出两周前开始的修改记录到文件gitk,“--”是为了避免和名为gitk的分支冲突 git log --since="2 weeks ago" -- gitk
查看test分支有但release分支没有的提交记录,并显示提交记录修改的路径信息 git log --name-status release..test
查看指定文件的修改记录,包含该文件被重命名等操作前的修改记录 git log --follow builtin/rev-list.c
本地有而远端没有的提交记录 git log --branches --not --remotes=origin
本地master分支有而远端master分支没有的提交记录 git log master --not --remotes=*/master
git log -p -m --first-parent
Shows the history including change diffs, but only from the “main branch” perspective, skipping commits that come from merged branches, and showing full diffs of changes introduced by the merges. This makes sense only when following a strict policy of merging all topic branches when staying on a single integration branch.
git log -L '/int main/',/^}/:main.c
Shows how the function main() in the file main.c evolved over time.
其他
keytool -list -v -keystore debug.keystore
keytool -printcert -file META-INF/CERT.RSA
jarsigner -verbose -keystore [keystorePath] -signedjar\
[apkOut] [apkIn] [alias] (给空白包签名)
jarsigner -verbose -verify -certs [apk]
aapt dump badging {PATH}.apk
iptables -I OUTPUT 1 -m hashlimit --hashlimit-name testup --hashlimit-above 5/s -j DROP
iptables -I INPUT 1 -m hashlimit --hashlimit-name testdown --hashlimit-above 5/s -j DROP
iptables -I INPUT 1 -m statistic --mode random --probability 0.8 -j DROP
iptables --list
iptables -F
busybox find [PATH] -size +10000k
find /root -size -5557c -size +5555c -exec ls -ld {} \;
sudo mount -t vboxsf share /mnt
mount.cifs -o username=username /////////////////path to ci package
kill `ps | grep processname | busybox awk '{print $2}'`