ADB安装与运行
install java
下载安装
注意选择JDK17以上版本
https://www.oracle.com/java/technologies/downloads/#jdk22-windows
选择中间的安装文件下载
编辑系统变量
C:\Program Files (x86)\Java\jdk-22
C:\Program Files (x86)\Java\jdk-22\bin
把C:\Program Files\Common Files\Oracle\Java\javapath放到%JAVA_HOME%\bin后面
检查版本
命令行安装Android SDK
下载Andoid SDK命令行工具
https://developer.android.com/studio/intro/update#sdk-manager
https://developer.android.com/tools/sdkmanager
The sdkmanager is a command-line tool that lets you view, install, update, and uninstall packages for the Android SDK. If you’re using Android Studio, then you don’t need to use this tool, and you can instead manage your SDK packages from the IDE.
The sdkmanager tool is provided in the Android SDK Command-Line Tools package. To use the SDK Manager to install a version of the command-line tools, follow these steps:
- Download the latest “command line tools only” package from the Android Studio downloads page and unzip the package.
- Move the unzipped cmdline-tools directory into a new directory of your choice, such as android_sdk. This new directory is your Android SDK directory.
- In the unzipped cmdline-tools directory, create a sub-directory called latest.
- Move the original cmdline-tools directory contents, including the lib directory, bin directory, NOTICE.txt file, and source.properties file, into the newly created latest directory. You can now use the command-line tools from this location.
https://developer.android.com/studio
###命令行安装Android SDK
cd C:\Setup\mobile\cmdline-tools\bin
C:\Setup\mobile\cmdline-tools\bin>sdkmanager --sdk_root=C:\Setup\mobile\android-sdk\ “cmdline-tools;latest”
C:\Setup\mobile\android-sdk\cmdline-tools\latest\bin>sdkmanager --list
下载Android SDK平台工具并调试
下载工具
https://developer.android.google.cn/tools/releases/platform-tools?hl=en
手机设置调试模式
手机设置打开以下蓝色选项
通过以下命令,让SDK获取手机授权
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb kill-server
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb start-server
此时在手机上确认USB为传输文件,而不是仅充电模式
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb devices
List of devices attached
bbf62877 device
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm list packages
卸载小米预装软件
以下软件均可安全卸载
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.sohu.inputmethod.sogou.xiaomi
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.android.browser
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.personalassistant
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.android.quicksearchbox
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.yellowpage
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.hybrid
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.miservice
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.contentextension
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.aiasst.service
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.voiceassist
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.gamecenter.sdk.service
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.analytics
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.bugreport
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.systemAdSolution
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.ab
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.accessibility
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.nextpay
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.payment
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.macro
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.freeform
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.miui.carlink
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.iflytek.inputmethod.miui
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 cn.wps.moffice_eng
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.shop
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.wallstreetcn.news
Success
C:\Setup\mobile\platform-tools-latest-windows\platform-tools>adb shell pm uninstall --user 0 com.xiaomi.mi_connect_service
Success