adb的安装与使用
Windows(win10测试)系统下的安装:
Ubuntu(16.04)系统下的安装:
链接: https://pan.baidu.com/s/1Zfo4N_4PVhdvgop_maUdoQ 提取码: 2qm4
adb常用命令
连接方式:使用usb连接线和通过网络连接
adb devices 列举设备
adb shell 进入设备
adb push
adb pull 拉取文件
进入设备后可以通过netcfg获取设备的ip
adb tcpip 5555 设置端口号,重启后消失
adb shell su -c setprop service.adb.tcp.port 5555
adb connect xx.xx.xx.xx 连接设备
exit 退出adb shell
adb root 以root权限进入
Sample
编写main.c
#include<stdio.h>
int main()
{
printf("hellworld\n");
return 1;
}
编译
/usr/local/toolchains/__android-ndk-r14b/gcc/android-21/android-armv7/bin/arm-linux-androideabi-gcc -o main main.c -pie -fPIE
adb push main /data/local/tmp
adb shell
cd /data/local/tmp
./main
会有unused DT entry 的错误
解决办法参考
https://blog.csdn.net/TMT123421/article/details/84798207