啟動
adb shell /data/local/tmp/android_server
端口轉(zhuǎn)發(fā)
adb forward tcp:23946 tcp:23946
從app啟動開始調(diào)試
adb shell am start -D -n package/MainActivity
jdb -connect com.sun.jdi.SocketAttach:hostname=127.0.0.1,port=8626
./android_server
adb forward tcp:23946 tcp:23946
異常
SeLinux 造成無法調(diào)試
1、檢測SELinux是否打開:getenforce
返回值:Enforcing:強(qiáng)制模式 Permissive:寬容模式 Disabled:關(guān)閉
C:\Users\user>adb shell getenforce
Enforcing
2、臨時關(guān)閉SELinux:setenforce 0
0為關(guān)閉,1為打開,執(zhí)行后立即生效,無需重啟
C:\Users\user>adb shell setenforce 0
C:\Users\user>adb shell getenforce
Permissive