極力推薦文章:歡迎收藏
Android 乾貨分享 android
本篇文章主要介紹 Android
開發中的部分知識點,經過閱讀本篇文章,您將收穫如下內容:程序員
1、ADB 簡介
2、ADB的工做方式
3、ADB經常使用命令
ADB(Android Debug Bridge) 是一個通用命令行工具,其容許您與模擬器實例或鏈接的 Android 設備進行通訊。它可爲各類設備操做提供便利,如安裝和調試應用,並提供對 Unix shell(可用來在模擬器或鏈接的設備上運行各類命令)的訪問。該工具做爲一個客戶端-服務器程序。shell
adb 工具路徑android_sdk/platform-tools/
緩存
ADB與本地 TCP 端口 5037 綁定,並偵遵從 adb 客戶端發送的命令—全部 adb 客戶端均使用端口 5037 與 adb 服務器通訊。而後,服務器設置與全部運行的Android模擬器/Android 設備鏈接。服務器
Settings >About phone>連續點擊 Build number七次微信
此方法不經常使用,暫時忽略app
adb install apk路徑
工具
adb unstall apk包名
學習
adb pull remote local
測試
adb push local remote
adb start-server
adb kill-server
adb shell screencap 文件保存路徑
adb shell screenrecord 文件保存路徑
按 Control + C 中止屏幕錄製,不然,到三分鐘或 --time-limit
設置的時間限制時,錄製將自動中止。
screenrecord 部分參數
選項 | 說明 |
---|---|
--size width x height | 設置分辨率 eg:1280x720 |
--bit-rate rate | 視頻比特率,默認值爲 4Mbps,能夠設6Mbps,這樣質量更好 eg:adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4 |
--time-limit time | 設置最大錄製時長(以秒爲單位)。默認值和最大值均爲 180(3 分鐘)。 |
adb shell am start -a android.intent.action.VIEW
adb shell am start -n 包名/類名
adb shell am startservice 包名/類名
adb shell am boradcast -a 廣播Action
adb shell force-stop 包名
adb shell pm uninstall 包名
adb shell pm list packages
adb shell pm list permission-groups
adb shell pm list features
adb shell pm path 包名
adb shell pm clear 包名
查看支持最多用戶數adb shell pm get-max-users
查詢系統全部用戶adb shell pm list users
建立新用戶adb shell pm create-user user_name
移除指定id用戶adb shell pm remove-user user_id
adb shell dumpsys activity | findstr Run
adb shell dumpsys package com.xxx.xxx(包名)
adb shell top
adb shell ps
結合findstr 命令 過濾多餘的信息 adb shell ps | findstr qq
adb logcat > 1.txt
adb logcat -s 關注log標籤
adb logcat -c
adb shell dumpsys battery unplug
adb shell settings put global low_power 1
adb shell dumpsys battery reset
進入Recovery 模式可使用組合鍵,也可使用adb 命令
adb 命令進入recovery 模式以下adb reboot recovery
adb shell pm disable com.google.android.setupwizard adb shell settings put global device_provisioned 1 adb shell settings put secure user_setup_complete 1
啓動開機嚮導命令
C:\Users\Administrator>adb shell am start com.google.android.setupwizard/.user.WelcomeActivity Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.android.setupwizard/.user.WelcomeActivity } C:\Users\Administrator>
至此,本篇已結束,若有不對的地方,歡迎您的建議與指正。同時期待您的關注,感謝您的閱讀,謝謝!