0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

fireflyROC-RK3308B主板CC-ADB调试工具简介

firefly 来源:firefly 作者:firefly 2019-12-20 09:03 次阅读
ADB 使用
前言

ADB,全称 Android Debug Bridge,是 Android 的命令行调试工具,可以完成多种功能,主要有:

  • 运行设备的 shell(命令行)

  • 管理模拟器或设备的端口映射

  • 计算机和设备之间上传/下载文件

  • 将本地 apk 软件安装至模拟器或硬件设备

ADB是一个“客户端-服务器端”程序,其中客户端主要是指 PC,服务器端是 Android 设备的实体机器或者虚拟机。根据 PC 连接 Box 机器的方式不同,ADB 可以分为两类:

  • 网络 ADB:主机通过有线/无线网络(同一局域网)连接到硬件设备

  • USB ADB:主机通过 USB 线连接到硬件设备

为了在ROC-RK3308B-CC也能使用ADB工具进行调试,我们移植了adb服务。但由于并非Android设备,很多adb命令类似adb logcat、adb install等不能使用,仅作为普通的调试辅助工具,可以进行shell交互、上传下载文件等操作。同样,网络远程ADB调试不能使用。

Buildroot 配置

准备连接

ROC-RK3308B-CC 只能使用USB ADB功能,使用USB ADB有以下限制:

  • 只支持 USB OTG 口

  • 不支持多个客户端同时使用(如 cmd 窗口,eclipse 等)

  • 只支持主机连接一个设备,不支持连接多个设备

用 USB Type-C 线连接设备和主机,运行adbdevices命令,如果显示机器的序列号,表示连接成功。

Windows下的 ADB 安装

首先参照安装 RK USB 驱动一节安装好驱动。然后下载 adb.zip,解压到C:\adb以方便调用。

打开命令行窗口,输入:

cdC:\adb adb shell

如果一切正常,就可以进入adbshell,在设备上面运行命令。

Ubuntu 下的 ADB 安装
  • 安装adb工具:

sudo apt-get install android-tools-adb
  • 加入设备标识:

mkdir -p ~/.android vim ~/.android/adb_usb.ini# 添加以下一行0x2207
  • 加入udev规则:

sudo vim /etc/udev/rules.d/51-android.rules# 添加以下一行:SUBSYSTEM=="usb", ATTR{idVendor}=="2207",MODE="0666"
  • 重新插拔USB线,或运行以下命令,让udev规则生效:

sudo udevadm control --reload-rules sudo udevadm trigger
  • 重新启动adb服务器

sudo adb kill-server adb start-server
常用 ADB 命令
连接管理

列出所有连接设备及其序列号

adb devices

如果有多个连接设备,通过以下命令,使用序列号来区分:

exportANDROID_SERIAL=<序列号> adb shell ls

进入设备的 shell

adb shell

电脑上传文件到设备

adb push <本地路径> <远程路径>

从设备下载文件到电脑

adb pull <远程路径> <本地路径>

暂不支持网络 adb 调试。

获取详细运行信息 adb bugreport

adb bugreport 用于错误报告,里面包含大量有用的信息。

示例:

adb bugreport# 保存到本地,方便用编辑器查看adb bugreport >bugreport.txt
命令行帮助信息 adb help

注意:并不是所有命令都能使用,帮助信息只做参考

AndroidDebugBridgeversion1.0.31-a-directsadbtolistenonallinterfacesforaconnection-d-directscommandtotheonlyconnectedUSBdevicereturnsanerrorifmorethanoneUSBdeviceispresent.-e-directscommandtotheonlyrunningemulator.returnsanerrorifmorethanoneemulatorisrunning.-s-directscommandtothedeviceoremulatorwiththegivenserialnumberorqualifier.OverridesANDROID_SERIALenvironmentvariable.-p-simpleproductnamelike'sooner',orarelative/absolutepathtoaproductoutdirectorylike'out/target/product/sooner'.If-pisnotspecified,theANDROID_PRODUCT_OUTenvironmentvariableisused,whichmustbeanabsolutepath.-H-Nameofadbserverhost(default:localhost)-P-Portofadbserver(default:5037)devices[-l]-listallconnecteddevices('-l'willalsolistdevicequalifiers)connect[:]-connecttoadeviceviaTCP/IPPort5555isusedbydefaultifnoportnumberisspecified.disconnect[[:]]-disconnectfromaTCP/IPdevice.Port5555isusedbydefaultifnoportnumberisspecified.UsingthiscommandwithnoadditionalargumentswilldisconnectfromallconnectedTCP/IPdevices.devicecommands:adbpush[-p]-copyfile/dirtodevice('-p'todisplaythetransferprogress)adbpull[-p][-a][]-copyfile/dirfromdevice('-p'todisplaythetransferprogress)('-a'meanscopytimestampandmode)adbsync[]-copyhost->deviceonlyifchanged(-lmeanslistbutdon't copy)(see'adb help all')adbshell-runremoteshellinteractivelyadbshell-runremoteshellcommandadbemu-runemulatorconsolecommandadblogcat[]-Viewdevicelogadbforward--list-listallforwardsocketconnections.theformatisalistoflineswiththefollowingformat:" "" ""\n"adbforward-forwardsocketconnectionsforwardspecsareoneof:tcp:localabstract:localreserved:localfilesystem:dev:jdwp:(remoteonly)adbforward--no-rebind-sameas'adb forward 'butfailsifisalreadyforwardedadbforward--remove-removeaspecificforwardsocketconnectionadbforward--remove-all-removeallforwardsocketconnectionsadbjdwp-listPIDsofprocesseshostingaJDWPtransportadbinstall[-l][-r][-d][-s][--algo--key--iv]-pushthispackagefiletothedeviceandinstallit('-l'meansforward-locktheapp)('-r'meansreinstalltheapp,keepingitsdata)('-d'meansallowversioncodedowngrade)('-s'meansinstallonSDcardinsteadofinternalstorage)('--algo','--key',and'--iv'meanthefileisencryptedalready)adbuninstall[-k]-removethisapppackagefromthedevice('-k'meanskeepthedataandcachedirectories)adbbugreport-returnallinformationfromthedevicethatshouldbeincludedinabugreport.adbbackup[-f][-apk|-noapk][-obb|-noobb][-shared|-noshared][-all][-system|-nosystem][]-writeanarchiveofthedevice's data to .Ifno-foptionissuppliedthenthedataiswrittento"backup.ab"inthecurrentdirectory.(-apk|-noapkenable/disablebackupofthe.apksthemselvesinthearchive;thedefaultisnoapk.)(-obb|-noobbenable/disablebackupofanyinstalledapkexpansion(aka.obb)filesassociatedwitheachapplication;thedefaultisnoobb.)(-shared|-nosharedenable/disablebackupofthedevice'ssharedstorage/SDcardcontents;thedefaultisnoshared.)(-allmeanstobackupallinstalledapplications)(-system|-nosystemtoggleswhether-allautomaticallyincludessystemapplications;thedefaultistoincludesystemapps)(isthelistofapplicationstobebackedup.Ifthe-allor-sharedflagsarepassed,thenthepackagelistisoptional.Applicationsexplicitlygivenonthecommandlinewillbeincludedevenif-nosystemwouldordinarilycausethemtobeomitted.)adbrestore-restoredevicecontentsfromthebackuparchiveadbhelp-showthishelpmessageadbversion-showversionnumscripting:adbwait-for-device-blockuntildeviceisonlineadbstart-server-ensurethatthereisaserverrunningadbkill-server-killtheserverifitisrunningadbget-state-prints:offline|bootloader|deviceadbget-serialno-prints:adbget-devpath-prints:adbstatus-window-continuouslyprintdevicestatusforaspecifieddeviceadbremount-remountsthe/systempartitiononthedeviceread-writeadbreboot[bootloader|recovery]-rebootsthedevice,optionallyintothebootloaderorrecoveryprogramadbreboot-bootloader-rebootsthedeviceintothebootloaderadbroot-restartstheadbddaemonwithrootpermissionsadbusb-restartstheadbddaemonlisteningonUSBadbtcpip-restartstheadbddaemonlisteningonTCPonthespecifiedportnetworking:adbppp[parameters]-RunPPPoverUSB.Note:youshouldnotautomaticallystartaPPPconnection.referstothettyforPPPstream.Eg.dev:/dev/omap_csmi_tty1[parameters]-Eg.defaultroutedebugdumplocalnottyusepeerdnsadbsyncnotes:adbsync[]canbeinterpretedinseveralways:-Ifisnotspecified,both/systemand/datapartitionswillbeupdated.-Ifitis"system"or"data",onlythecorrespondingpartitionisupdated.environmentalvariables:ADB_TRACE-Printdebuginformation.Acommaseparatedlistofthefollowingvalues1orall,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwpANDROID_SERIAL-Theserialnumbertoconnectto.-stakespriorityoverthisifgiven.ANDROID_LOG_TAGS-Whenusedwiththelogcatoption,onlythesedebugtagsareprinted.

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 嵌入式主板
    +关注

    关注

    7

    文章

    6060

    浏览量

    34563
  • 安卓
    +关注

    关注

    5

    文章

    2075

    浏览量

    54097
  • Firefly
    +关注

    关注

    2

    文章

    533

    浏览量

    6735
  • RK3308
    +关注

    关注

    1

    文章

    39

    浏览量

    910
收藏 人收藏

    评论

    相关推荐

    如何安装ADB调试工具

    如何安装ADB调试工具
    发表于 12-24 06:58

    android fastboot/adb 驱动调试工具

    android fastboot/adb 驱动调试工具,用于fastboot烧录和adb调试android
    发表于 11-04 16:01 9次下载

    firefly RK3308开发板ROC-RK3308-CC四核64位AIOT主板规格

    ROC-RK3308-CC 四核64位AIOT主板
    的头像 发表于 11-03 11:08 4244次阅读
    firefly <b class='flag-5'>RK3308</b>开发板ROC-<b class='flag-5'>RK3308-CC</b>四核64位AIOT<b class='flag-5'>主板</b>规格

    Firefly-RK3128主板ADB调试工具介绍

    adb,全称 Android Debug Bridge,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志,上传下载文件,安装应用等。
    的头像 发表于 11-29 09:24 4330次阅读
    Firefly-<b class='flag-5'>RK</b>3128<b class='flag-5'>主板</b><b class='flag-5'>ADB</b><b class='flag-5'>调试工具</b>介绍

    fireflyAIO-3288C主板ADB调试工具介绍

    adb,全称 Android Debug Bridge,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志,上传下载文件,安装应用等。
    的头像 发表于 12-16 14:58 1363次阅读
    fireflyAIO-3288C<b class='flag-5'>主板</b><b class='flag-5'>ADB</b><b class='flag-5'>调试工具</b>介绍

    fireflyCORE-RK3328主板JD4--Adb调试工具简介

    Adb 是 Android Debug Bridge 的简称,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志、上传下载文件、安装应用等。
    的头像 发表于 12-18 14:17 1555次阅读

    fireflyROC-RK3308B主板CC-U-Boot简介

    RK U-Boot 基于开源的 U-Boot 进行开发,工作模式有启动加载模式和下载模式。
    的头像 发表于 12-20 08:59 1208次阅读
    <b class='flag-5'>fireflyROC-RK3308B</b><b class='flag-5'>主板</b><b class='flag-5'>CC</b>-U-Boot<b class='flag-5'>简介</b>

    fireflyROC-RK3308B-CC--启动模式说明

    ROC-RK3308B-CC 有着非常灵活的启动方式。一般情况下,除非硬件损坏,ROC-RK3308B-CC 主板是不会变砖的。
    的头像 发表于 12-20 09:20 2458次阅读

    fireflyROC-RK3308B主板CC教程简介

    确认主板配件连接无误后,通过 USB Type-C 线给 ROC-RK3308B-CC 供电。
    的头像 发表于 12-20 09:32 1928次阅读

    fireflyROC-RK3399主板PC-Adb简介

    Adb 是 Android Debug Bridge 的简称,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志、上传下载文件、安装应用等。
    的头像 发表于 12-20 10:49 927次阅读

    fireflyROC-RK3328主板PC Adb简介

    Adb 是 Android Debug Bridge 的简称,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志、上传下载文件、安装应用等。
    的头像 发表于 12-21 09:22 1119次阅读

    fireflyROC-RK3328主板CC-Adb简介

    Adb 是 Android Debug Bridge 的简称,是 Android 的命令行调试工具,可以完成多种功能,如跟踪系统日志、上传下载文件、安装应用等。
    的头像 发表于 12-21 10:45 976次阅读

    微雪电子ROC-RK3308主板CC-ADB介绍

    ADB,全称 Android Debug Bridge,是 Android 的命令行调试工具,可以完成多种功能
    的头像 发表于 12-23 15:31 1101次阅读
    微雪电子ROC-<b class='flag-5'>RK3308</b><b class='flag-5'>主板</b><b class='flag-5'>CC-ADB</b>介绍

    微雪电子RK3308主板CC启动模式介绍

    ROC-RK3308-CC 有着非常灵活的启动方式。一般情况下,除非硬件损坏,ROC-RK3308-CC 主板是不会变砖的。
    的头像 发表于 12-23 15:47 1992次阅读

    微雪电子RK3308主板CC上手介绍

    确认主板配件连接无误后,通过 USB Type-C 线给 ROC-RK3308-CC 供电。
    的头像 发表于 12-23 15:50 1939次阅读