app_process 启动程序 调试debug

首先

adb forward tcp:5005 tcp:5005
通过 adb forward tcp:PC端口 tcp:手机端口 把手机端口映射到PC本地
端口号可以自定义,只要没有被占用即可

Android < 9

app_process 后面添加-agentlib:jdwp=transport=dt_socket,suspend=y,server=y,address=5005 即可
举例:adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process -agentlib:jdwp=transport=dt_socket,suspend=y,server=y,address=5005 / com.genymobile.scrcpy.Server 1.25 log_level=info bit_rate=8000000

Android 9 和 Android 10

app_process 后面添加-XjdwpProvider:internal -XjdwpOptions:transport=dt_socket,suspend=y,server=y,address=5005 即可
举例:adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process -XjdwpProvider:internal -XjdwpOptions:transport=dt_socket,suspend=y,server=y,address=5005 / com.genymobile.scrcpy.Server 1.25 log_level=info bit_rate=8000000

Android >10

目前暂时没有debug的方法,建议还是找个低版本的手机debug,等后续有的话,在更新博客

Android Studio

Run > Debug > Edit configurations... On the left, click on +, Remote, and fill the form:


image.png

Apply > OK后,就可以点击debug按钮,断点调试了

你可能感兴趣的:(app_process 启动程序 调试debug)