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}'`
