身處在開發Android的公司,adb指令可以說是跟mobile device有非常密切的關係,舉凡push, pull data到devices上,甚至debug除錯等,都會需要使用到adb工具,所以了解並熟悉adb的一些指令對於開發上具有非常大之幫助。


◎這裡列出官網上提到,以及比較常使用到的指令

1.adb devices (顯示目前有多少個模擬器正在執行) 

2.adb -s (指定模擬器來操作)  
    Ex:adb -s emulator-5554 install camera.apk

3.adb install apkfile (安裝 APK 應用程式套件) 
    Ex:adb install camera.apk

4.adb uninstall package (移除 APK 應用程式套件)  
    Ex:adb uninstall com.android.camera

5.adb shell (進入 Android 系統指令列模式)

6.adb push (複製檔案到 SD 卡)  
    Ex:adb push mp3 /sdcard

7.adb pull . (從 Android 系統下載檔案)  

    Ex:adb pull /data/app/com.android.email

8.adb logcat(印出device的log)

9.adb shell procrank
用來查看memory,執行出來結果如下,因為使用Linux下的top來計算記憶體使用量會比較不精確,若是在android上開發時,最好是使用Google提供的tool來偵測,會相對準確一些。

PID    Vss             Rss       Pss           Uss             cmdline
580  139500K 139500K    62611K  57112K      Weather
134  94412K     94412K    27817K  22804K      /system/bin/lockscreend
915  91120K     91120K    14487K  9272K        WidgetTest


主要是看USS下的數值。
底下說明每個代表的意義:

Column Name
Meaning
VSS
Virtual Set Size: how much virtual memory associated with process
RSS
Resident Set Size: how much physical pages allocated for the process. Pages shared between processes are counted multiple times
PSS
Proportional Set Size. Take the RSS number but evenly distribute shared pages among the sharing processes. For example, if three processes are sharing 3MB, each process gets 1MB in PSS.
USS
Also known as Private Dirty, which is basically the amount of RAM inside the process that can not be paged to disk (it is not backed by the same data on disk), and is not shared with any other processes.


10. adb shell input text 'ABCD'
有時候用鍵盤輸入帳號密碼很麻煩,此時就可以透過鍵盤輸入ABCD字串到EditText欄位上。

arrow
arrow
    全站熱搜

    cloudfly 發表在 痞客邦 留言(0) 人氣()