What does dynamic debugging do? Where static analysis is not easy to understand, dynamic debugging comes in handy!

Dynamic debugging can track the running process of the program, so as to understand the business logic of competing products.

steps

  1. Note that Android P cannot be used
  2. Install the apK modified with Android Killer on your phoneandroid:debuggable="true")
  3. Start in debug modeadb shell am start -D -n com.example.myapplication/com.example.myapplication.MainActivity, the app will be in the state of waiting for debugging.
  4. adb shell ps | findstr com.example.myapplicationCheck the pid
    u0_a78    3813  1399  1375708 30176 futex_wait 00000000 S com.example.myapplication
    Copy the code
  5. adb forward tcp:8700 jdwp:3813Establishing port Forwarding
  6. Decompilated smali folder with Android Studio 3.x: File-> openAndroidKiller_v1. 3.1 \ projects \ app - debug \ Project.

    X: File-> Profile or debug APK

  7. Using the Project view, right-click the Project Directory –> Mark Directory as… –> Sources root
  8. Android Studio 3.x: Run -> Edit Configuration -> Remote -> 8700
  9. debug app

The lazy script (more) please click https://github.com/andych008/cmd

Adbbind. Bat com. Example. Myapplication, complete process, find and port forwarding.

Use BusyBox. Make sure you have it on your phone.

@echo off

adb forward --remove tcp:8700

for /F %%i in ('adb shell busybox pidof %1') do ( set pid=%%i)

echo pid=%pid%

adb forward tcp:8700 jdwp:%pid%

netstat -nao | findstr "8700"

Copy the code

Further reading

  • Why can’t YOU use Android P

  • Smalidea watchers “Internal error”

  • Watch register showing “Collecting data”

  • Error: Cannot bind listener: cannot bind to 127.0.0.1:8700: This error indicates that port 8700 is occupied. Normally each socket address (protocol/network address/port) can only be used once.

    Solution netstat nao | findstr searches “8700” find the process based on PID, the end of the process Open the task manager – > view – > options column (S) – > check the PID, determine the process – > button bar