ADB常用命令

  • ADB常用命令
  •   
    
    
    查看当前应用的包名与应用:
       1,adb shell
       2,dumpsys activity top
    
    查所有设备的vid与pid:
       1,adb shell
       2, getevent -v
        
    adb push 电脑文件path /storage/emulated/0/Download/
    
    通过adb启动APP:
      adb shell am start  aws.apps.usbDeviceEnumerator/.ui.main.MainActivity
      格式解析: adb shell am start 包名/启动Activity
    
    通过adb杀死APP:
      adb shell ps //查看进程 (可以看到进程PID)
      adb shell kill PID
    
    
    通过adb查看hidraw设备的vid pid:
      adb shell ls -l /sys/class/hidraw/hidraw*  
    
    
    通过adb执行monkey:
       adb shell monkey -p apk包名 -v 500
    
    
    adb 修改logcat buffer:https://blog.youkuaiyun.com/qq_31811537/article/details/90059840
    adb 修改权限:
       adb shell
       chmod 777 hidraw*
     
    adb 输出指定app log到文件:
        adb logcat --pid=$(adb shell pidof -s com.android.bluetooth) > logcat.log
    
    adb push的时候有时候会遇到readonly:
       adb remount -o rw,remount
    
    
    查看SO被哪些进程调用:(lsof)
       lsof /system/lib/libnetd_client.so
    
    
    adb 无线调试:
       1,首页用usb线连接电脑
       2, adb tcpip 5555
       3,拔掉手机usb数据线,就可以直接用adb connect 连接手机  
    
    
    设置logcat buffer大小:
       adb logcat -G 10M
    查看logcat buffer:
       adb logcat -g
    
    Android设置配置忏悔:
       https://blog.youkuaiyun.com/wangjia55/article/details/7446772 
    
     
    
    

  • Android常用编译命令
  • 
    mm 构建模块在当前文件夹,不构建依赖
    mmm 构建模块指定路径,不构建依赖
    mma 构建模块在当前文件夹并构建依赖
    mmma 构建模块在当前文件夹并构建依赖
    
    例如:出现以下错误
    ninja: error: 'out/target/common/obj/JAVA_LIBRARIES/metrics-helper-lib_intermediates/classes-header.jar', needed by 'out/target/common/obj/APPS/SystemUISharedLibTests_intermediates/classes-full-debug.jar', missing and no known rule to make it
    09:39:22 ninja failed with: exit status 1
    在整体编译时部分依赖测试不会进行编译,所以使用使用mmm时会提示依赖出错,此时应该用mmma或者mm进行编译

  • Linux查找

 

grep搜索:
目的:使用grep命令来查找文件中符合条件的字符串
格式:grep  [选项]	 [查找模式]  [文件名]
     -r (recursive):递归查找
     -n (number):显示目标位置的行号

如:
在当前目录递归查找字符串abc:grep -rn "abc" *         
根据文件名索引:grep -name xxx
根据文件内容搜索:grep -s -R -n '#define LOG_TAG "audio_hw_primary"'
根据文件内容搜索: grep -a libbt-vendor  . -r --include *.mk //从当前目录搜索所有.mk文件中的libbt-vendor



find:查找符合条件的文件
   格式:  find    目录名    选项    查找条件

    find /work/  -name "test1.txt"  /work 目录下查找test1.txt
    find . -name "*.txt"      find  -name "*.txt",其中.代表当前路径  
    find  -name "*.txt"   当前目录查找所有.txt
    find /home -mtime -2  查找/home目录下两天内有变动的文件

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值