————————————- read the fucking source code——————————–
1.shift+ctrl+a 可以查找任何需要的命令設置
2.ctrl+alt+空格 可以自動補齊
3.ctrl+shift+enter 可以自動補全當前表達式所缺的部分,對if else for while等語句有效。
4.shift+enter可以跳入到下一行。
5.使用dumpsys activity services 包名 打印出mptt應用所有進程中的service信息。
6.ps|grep 包名 查看mptt應用所在的進程信息
7.adb shell dumpsys meminfo 包名 查看應用的內存使用情況
8.adb 抓特定app的log:adb shell ps| grep 2}”
9.ctrl+shift+o 清理多餘的import文件
10.android studio中analysis中有個lint工具可以分析代碼
11.android studio 中androidmainfest文件通過修改versionCode 和 versionName來修改版本信息
12.getResources().getConfiguration().locale.getLanguage().endsWith(“zh”)獲取當前系統的語言系統
13.Android通過tcpdump抓包
1. 手機要有root權限
2. 下載tcpdump http://www.strazzere.com/android/tcpdump
3. adb push c:\wherever_you_put\tcpdump /data/local/tcpdump
4. adb shell chmod 6755 /data/local/tcpdump
5. adb shell, su獲得root權限
6. cd /data/local
7. ./tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
do whatever you want to capture, then ^C to stop it …
8. adb pull /sdcard/capture.pcap d:/
- 在電腦上用wireshark打開capture.pcap即可分析log
14.從adb獲取手機截圖 adb shell screencap /sdcard/001.png —-adb pull /sdcard/001.png .