如何配置自己的源码调试环境
1 编译源码
repo sync -j8 --fail-fast
.build/envsetup.sh
lunch 选73
make -j8
emulator
2 配置android studio
sudo apt install openjdk-9-jre-headless //安装java
https://developer.android.google.cn/studio//下载studio
解压后打开bin里面的studio64.vmoptions文件前两项内存增加四倍
make idegen -j8
sudo development/tools/idegen/idegen.sh
生成了android.iml 和android.ipr文件
修改android.iml文件 将不需要的删掉或注释掉
仅保留framwork和pakager就行了
androd studio bin目录 ./studio.sh //
导入android.ipr即可
可以跳转,可以debug
3 编译framwork相关指令:
make -j32 framework-minus-apex
adb root
adb remount
adb shell "rm -rf /system/framework/arm"
adb push framework.jar /system/framework
adb shell sync
adb reboot
编译frameworks/base/core/res
frameworks/base/core/res当初apk流程就行
编译services
make -j32 services
adb root
adb remount
adb shell "rm -rf /system/framework/arm"
adb push services.jar /system/framework
adb shell "rm -rf /data/dalvik-cache/arm/system@framework@services.jar@classes.* "
adb shell sync
adb reboot
4 常用指令:
pwd //查看当前目录
find -name *** //查找文件
grep "***" ./ -rn //查找关键字
logcat -s TAG //过滤tag
logcat -grep "***"//过滤关键字
Log.i("yang","start",new Exception());//打印堆栈
ps -A |grep **//搜索进程