adb

参考:http://codeseekah.com/2012/02/09/command-line-android-development-basics/

         http://ubuntuforums.org/showthread.php?t=1918512

 

1、pemission deny

     在android 文件系统下进行某些操作时没有权限,此时执行:

     (1)adb root

     (2)adb remount /system/

     (3)adb push file /system/lib

 

2、进入 fastboot 模式

(1)进入fastboot模式

        adb reboot bootloader

(2)列出进入fastboot模式的设备

        fastboot devices

(3)fasbtoot模式下使用adb

       一:fastboot oem fastboot2adb

       二:fastboot continue

 

3、通过fastboot烧写 内核镜像

     首先进入fasbtoot模式

     然后执行  fastboot flash boot boot.img 

 

adb install

Install to a device: adb -d install -r bin/your-application-debug.apk
The emulator: adb -e install -r bin/your-application-debug.apk

The -r flag allows you to do a re-installation instead of an installation. When trying to install to a device that already has the application installed an error will occur.

安装测试程序:
su –c pm install  /sdcard/test.apk

 

 

 adb 卸载应用程序

adb 卸载应用程序。通过ADB卸载一个应用程序,必须知道这个应用程序的程序包名称。程序包的名字未必就是APK文件名
1、adb shell

2、pm list packages
   列出所有的 程序包 名称

3、exit

4、adb uninstall package_name

5、显示success,表示移除成功。

卸载测试程序:
su –c pm uninstall com.example.MyApp

 

 

adb 传送文件

adb push {host_path} {target_path}
adb pull {target_path} {host_path}

 

adb 启动应用程序

adb shell 'am start -n your_package_name/.youractivityname

You can launch most Android Settings sub-screens by starting the SubSettings Activity and including the:android:show_fragment extra with the appropriate fully-qualified class name of an existing Android PreferenceFragment subclass.

For example, to start UserSettings:
adb shell am start -n com.android.settings/com.android.settings.SubSettings -e :android:show_fragment com.android.settings.users.UserSettings

To start DeviceInfoSettings: adb shell am start -n com.android.settings/com.android.settings.SubSettings -e :android:show_fragment com.android.settings.DeviceInfoSettings
To find other Settings, checkout the Android source and look for subclasses of PreferenceFragment in the packages/apps/Settings.

 

执行lsusb                                                                       
获得:                                                                          
Bus 002 Device 004: ID 18d1:deed Google Inc.                                    
在/etc/udev/rules.d/51-android.rules中添加                                      
SUBSYSTEM=="usb", SYSFS{"Google Inc."}=="18d1", MODE="0666"                     
                                                                                
执行                                                                            
chmod a+rx /etc/udev/rules.d/51-android.rules                                   
/etc/init.d/udev restart                                                        
adb kill-server                                                                 
adb devices 

 

adb shell 登录到系统后,可以用getprop命令查看当前系统中有哪些属性。

 

如何通过  ssh 使用 adb

http://redkrieg.com/2010/10/11/adb-over-ssh-fun-with-port-forwards/

 

 

附:

If you are using a 64-bit version of Linux, you may need to install the ia32-libspackage. To check whether you need this package, try running the adbcommand(~/android-sdk-linux_*/platform-tools/adb). If your systemreports that adb cannot be found (despite being right there in the platformtoolsdirectory) it likely means that the current version of adb, and possibly other tools, will not run without the ia32-libspackage installed. The command to install the ia32-libspackage is:
               sudo apt-get install ia32-libs

 

 

 

 

posted on 2014-04-28 17:47  阿加  阅读(488)  评论(0编辑  收藏  举报

导航