美文网首页Android技术收藏
adb shell am 命令之debug技巧

adb shell am 命令之debug技巧

作者: act262 | 来源:发表于2017-08-05 20:42 被阅读334次

adb shell am 命令之debug技巧

Tags: adb_shell


我们一般的调试方式都是先在某个地方打上断点,然后在运行中用ASAttach debugger to Android process进行调试的,这种方式不适合在启动app的地方断点调试,如果需要在启动的地方调试则需要Run Debug app,然而这种方式一般都是比较慢的,尤其是大项目,因为这里包含了编译运行等工作。

可以使用am的set-debug-app调试命令来操作

# 开启调试模式
am set-debug-app: set application <PACKAGE> to debug.  Options are:
    -w: wait for debugger when application starts
    --persistent: retain this value
# 清除调试模式    
am clear-debug-app: clear the previously set-debug-app.    

-w 启动时等待Debugger Attacth
--persistent 每次启动都开启调试模式,没有这个标志则表示一次性的

开启调试某个app

adb shell am set-debug-app -w com.micro.demo

运行上面命令后,app启动,并弹出Waiting For Debugger的弹窗提示,
此时打开AS的Attach debugger to Android process即可,此时我们就可以方便在app启动时的断点调试了。

相关文章

  • adb shell am 命令之debug技巧

    adb shell am 命令之debug技巧 Tags: adb_shell 我们一般的调试方式都是先在某个地方...

  • adb shell am 命令

    adb shell am 命令 Tags: adb_shell am命令对应的是ActivityManagerSe...

  • ADB常用命令集合

    基础命令 USB设备命令 文件传输命令 SHELL命令 adb shell pm命令 adb shell am命令...

  • adb命令

    命令集 adb devices adb tcpip port adb connect adb shell am -...

  • adb shell常用命令

    adb shell进入手机(也可直接使用adb shell 加 下面的命令): 启动am start -a and...

  • 34个Android常用adb shell命令汇总

    警言:慎终如始! 调试Android程序有时需要adb shell 命令,adb全称Android Debug B...

  • adb shell am 命令

    adb shell am start [options] intent启动由 intent 指定的 Activit...

  • adb shell logcat 命令

    adb shell logcat 命令 Tags: adb_shell adb shell logcat命令映射为...

  • android 常用

    1.发送adb命令打开界面注意在数据&时使用\进行转义。adb shell am start -a 'androi...

  • adb命令大全

    adb命令与adb shell命令的区别? adb命令是PC端adb程序自带的命令 adb shell 命令是调用...

网友评论

    本文标题:adb shell am 命令之debug技巧

    本文链接:https://www.haomeiwen.com/subject/uiuwlxtx.html