您的位置:首页 > 移动开发 > Android开发

Android命令行总结

2015-11-11 14:52 363 查看
删除system/app下的apk

adb shell su -c mount -o remount /dev/block/mtdblock0 /system

adb shell su -c chmod 777 /system

adb shell su -c chmod 777 /system/app

adb shell su -c rm /system/app/1adbreboot1
adb reboot
1 为参数

将apk push到手机

cd android/sdk/platform-tools

./adb shell su -c mount -o remount /dev/block/mtdblock0 /system

./adb shell su -c chmod 777 /system

./adb shell su -c chmod 777 /system/app

./adb push ~/git/glass/BusinessGlass/bin/BusinessGlass.apk /system/app/

./adb reboot

adb 查看log 并保存到文件

./adb logcat -v time mqttmsg:V *:E | tee ~/log.txt –日志保存到log.txt文件

./adb logcat -v time | grep test**** —过滤标签为test的日志

adb logcat -v time -s TAG1 -s TAG2 —过滤标签TAG1,TAG2

查看设备ip地址 ./adb shell netcfg

更改设备端口号 ./adb tcpip 5555

无线连接设备 ./adb connect 192.168.0.123 –假设android设备ip为192.168.0.123

adb 查看相机参数 cat /system/etc/media_profiles.xml

使用Adb shell command直接送key event給Android

adb shell input keyevent 7 # for key ‘0’

adb shell input keyevent 8 # for key ‘1’

adb shell input keyevent 29 # for key ‘A’

adb shell input keyevent 54 # for key ‘B’

adb shell input text “ANDROID” —文本框中输入ANDROID

支持的KEYCODE

0 –> “KEYCODE_UNKNOWN”

1 –> “KEYCODE_MENU”

2 –> “KEYCODE_SOFT_RIGHT”

3 –> “KEYCODE_HOME”

4 –> “KEYCODE_BACK”

5 –> “KEYCODE_CALL”

6 –> “KEYCODE_ENDCALL”

KEYCODE_DPAD_UP = 19;

KEYCODE_DPAD_DOWN = 20;

KEYCODE_DPAD_LEFT = 21;

KEYCODE_DPAD_RIGHT = 22;

adb pull/push Permission denied 解决方法

chmod 777 data 授权

分析应用程序四大组件,内存占用,CPU

adb shell dumpsys meminfo cn.ceyes.smartglasslauncher

手机刷机

进入bootloader

adb reboot bootloader

计算机进入刷机包目录

cd /tools/hammerhead-mra58k

执行以下脚本

fastboot flash bootloader bootloader-hammerhead-hhz12k.img

fastboot reboot-bootloader

sleep 5

fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.27.img

fastboot reboot-bootloader

sleep 5

fastboot -w update image-hammerhead-mra58k.zip

执行结果

kongdexing@hdserver:~/tools/nexusRom/nexus5_5.1.1/hammerhead-lmy47d$ ./flash-all.sh

target reported max download size of 1073741824 bytes

sending ‘bootloader’ (2579 KB)…

OKAY [ 0.251s]

writing ‘bootloader’…

OKAY [ 0.487s]

finished. total time: 0.738s

rebooting into bootloader…

OKAY [ 0.129s]

finished. total time: 0.179s

target reported max download size of 1073741824 bytes

sending ‘radio’ (45425 KB)…

OKAY [ 1.590s]

writing ‘radio’…

OKAY [ 3.115s]

finished. total time: 4.705s

rebooting into bootloader…

OKAY [ 0.132s]

finished. total time: 0.182s

target reported max download size of 1073741824 bytes

archive does not contain ‘boot.sig’

archive does not contain ‘recovery.sig’

archive does not contain ‘system.sig’

archive does not contain ‘tos.img’

Creating filesystem with parameters:

Size: 13725835264

Block size: 4096

Blocks per group: 32768

Inodes per group: 8144

Inode size: 256

Journal blocks: 32768

Label:

Blocks: 3351034

Block groups: 103

Reserved block group size: 823

Created filesystem with 11/838832 inodes and 93654/3351034 blocks

Creating filesystem with parameters:

Size: 734003200

Block size: 4096

Blocks per group: 32768

Inodes per group: 7472

Inode size: 256

Journal blocks: 2800

Label:

Blocks: 179200

Block groups: 6

Reserved block group size: 47

**Created filesystem with 11/44832 inodes and 5813/179200 blocks

——————————————–**

Bootloader Version…: HHZ12f

Baseband Version…..: M8974A-2.0.50.2.25

**Serial Number……..: 034d68be828dd1c3

——————————————–**

checking product…

OKAY [ 0.100s]

checking version-bootloader…

OKAY [ 0.100s]

checking version-baseband…

OKAY [ 0.100s]

sending ‘boot’ (8930 KB)…

OKAY [ 0.500s]

writing ‘boot’…

OKAY [ 0.765s]

sending ‘recovery’ (9648 KB)…

OKAY [ 0.567s]

writing ‘recovery’…

OKAY [ 0.800s]

erasing ‘system’…

OKAY [ 1.099s]

sending ‘system’ (1021552 KB)…

OKAY [ 33.707s]

writing ‘system’…

OKAY [ 68.496s]

erasing ‘userdata’…

OKAY [ 10.541s]

sending ‘userdata’ (137318 KB)…

OKAY [ 4.650s]

writing ‘userdata’…

OKAY [ 9.243s]

erasing ‘cache’…

OKAY [ 0.550s]

sending ‘cache’ (13348 KB)…

OKAY [ 0.640s]

writing ‘cache’…

OKAY [ 1.071s]

rebooting…

finished. total time: 134.151s

出现问题后请抓如下trace:

android/kernel trace:

adb logcat | tee android.logcat

adb shell su -c cat /proc/kmsg | tee kernel.kmsg

adb pull /sdcard/offlinelog/

adb pull /data/anr

查看android系统版本号

adb shell getprop | grep disp

adb shell getprop | grep inc
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: