ubuntu 安装adb和fastboot

The main Web Upd8 PPA maintained by: http://www.webupd8.org/

添加个人软件包档案:

To add this PPA, simply paste this in a terminal:
sudo add-apt-repository ppa:nilarimogard/webupd8

Packages in this PPA: audacious, ap-hotspot, awn-applet-radio, awn-applet-wm, calise, cmus, dockbarx, dockbarx-themes-extra, dropbox-share, emerald, exaile, fbmessenger, gnome-subtitles, gnome-window-applets, grsync, grive, gthumb, launchpad-getkeys, mc, mdm (Mint Display Manager), minitunes, minitube, musique, notifyosdconfig, nautilus-columns, powertop, ppa-purge, rosa-media-player, fixed pulseaudio-equalizer, subtitleeditor, syncwall, umplayer, unity-reboot, wimlib, youtube-dl, xfce4-dockbarx-plugin, xournal, yad, yarock and others. Almost all packages are updated to their latest version.

执行更新:

sudo apt-get update

安装adb和fastboot

sudo apt-get install android-tools-adb android-tools-fastboot


常用adb命令:

1. 显示系统中全部Android平台:    android list targets  

 2. 显示系统中全部AVD(模拟器):    android list avd   

3. 创建AVD(模拟器):    android create avd --name 名称 --target 平台编号   

4. 启动模拟器:    emulator -avd 名称 -sdcard ~/名称.img (-skin 1280x800)  

 5. 删除AVD(模拟器):    android delete avd --name 名称  

 6. 创建SDCard:    mksdcard 1024M ~/名称.img   

7. AVD(模拟器)所在位置:    Linux(~/.android/avd) Windows(C:\Documents and Settings\Administrator\.android\avd)  

 8. 启动DDMS:    ddms  

 9. 显示当前运行的全部模拟器:    adb devices   

10. 对某一模拟器执行命令:    abd -s 模拟器编号 命令  

 11. 安装应用程序:    adb install -r 应用程序.apk  

 12. 获取模拟器中的文件:    adb pull <remote> <local>   

13. 向模拟器中写文件:    adb push <local> <remote>   

14. 进入模拟器的shell模式:    adb shell   

15. 启动SDK,文档,实例下载管理器:    android  

 16. 卸载apk包:    adb shell    cd data/app    rm apk包    exit    adb uninstall apk包的主包名    adb install -r apk包  

 17. 查看adb命令帮助信息:    adb help   

18. 在命令行中查看LOG信息:    adb logcat -s 标签名   

19. adb shell后面跟的命令主要来自:    源码\system\core\toolbox目录和源码\frameworks\base\cmds目录。   

20. 删除系统应用:    adb remount (重新挂载系统分区,使系统分区重新可写)。    adb shell    cd system/app    rm *.apk   

21. 获取管理员权限:    adb root  

 22. 启动Activity:    adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。   

23、发布端口:    你可以设置任意的端口号,做为主机向模拟器或设备的请求端口。    如:adb forward tcp:5555 tcp:8000  

 24、复制文件:    你可向一个设备或从一个设备中复制文件,   

复制一个文件或目录到设备或模拟器上:    adb push <source> <destination></destination></source>    如:adb push test.txt /tmp/test.txt  

 从设备或模拟器上复制一个文件或目录:    adb pull <source> <destination></destination></source>    如:adb pull /addroid/lib/libwebcore.so    

25、搜索模拟器/设备的实例:    取得当前运行的模拟器/设备的实例的列表及每个实例的状态:    adb devices  

 26、查看bug报告:    adb bugreport   

27、记录无线通讯日志:    一般来说,无线通讯的日志非常多,在运行时没必要去记录,但我们还是可以通过命令,设置记录:    adb shell    logcat -b radio    

28、获取设备的ID和序列号:    adb get-product    adb get-serialno   

29、访问数据库SQLite3    adb shell    sqlite3   

#cd system/sd/data //进入系统内指定文件夹 

 #ls //列表显示当前文件夹内容  

 #rm -r xxx //删除名字为xxx的文件夹及其里面的所有文件  

 #rm xxx //删除文件xxx   

#rmdir xxx //删除xxx的文件夹


fastboot 使用(来自fastboot帮助)

usage: fastboot [ <option> ] <command>

commands:
  update <filename>                        reflash device from update.zip     #升级设备
  flashall                                             flash boot + recovery + system    #刷新所有分区
  flash <partition> [ <filename> ]         write a file to a flash partition   #向flash分区写入文件
  erase <partition>                        erase a flash partition                       #清除一个分区
  format <partition>                       format a flash partition                      #格式化一个分区
  getvar <variable>                        display a bootloader variable        #显示一个启动参数
  boot <kernel> [ <ramdisk> ]              download and boot kernel      #下载并引导内核启动系统
  flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it  #创建一个boot.img并下载到设备启动系统
  devices                                  list all connected devices                     #列出所有连接的设备
  continue                                 continue with autoboot                         #继续自动启动
  reboot                                   reboot device normally                          #正常重启
  reboot-bootloader                        reboot device into bootloader    #启动系统到bootloader
  help                                     show this help message                        #显示帮助

options:
  -w                                       erase userdata and cache (and format
                                           if supported by partition type)
  -u                                       do not first erase partition before
                                           formatting
  -s <specific device>                     specify device serial number
                                           or path to device port
  -l                                       with "devices", lists device paths
  -p <product>                             specify product name
  -c <cmdline>                             override kernel commandline
  -i <vendor id>                           specify a custom USB vendor id
  -b <base_addr>                           specify a custom kernel base address
  -n <page size>                           specify the nand page size. default: 2048
  -S <size>[K|M|G]                         automatically sparse files greater than
                                           size.  0 to disable


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值