46

如何使用 ADB 命令在 android 中恢复出厂设置?我曾使用 adb reboot recovery 命令进行重置。但是第三方应用程序无法以某种方式清除。使用ADB实现的正确方法是什么?

实际上,我想通过 java 代码对 android 设备进行出厂重置。这里有什么解决方案?

4

4 回答 4

85

您可以在 adb 中发送意图MASTER_CLEAR

adb shell am broadcast -a android.intent.action.MASTER_CLEAR

或作为根

adb shell  "su -c 'am broadcast -a android.intent.action.MASTER_CLEAR'"
于 2016-02-17T01:59:18.720 回答
21

尝试 :

adb shell
recovery --wipe_data

这是参数列表:

* The arguments which may be supplied in the recovery.command file:
 *   --send_intent=anystring - write the text out to recovery.intent
 *   --update_package=path - verify install an OTA package file
 *   --wipe_data - erase user data (and cache), then reboot
 *   --wipe_cache - wipe cache (but not user data), then reboot
 *   --set_encrypted_filesystem=on|off - enables / diasables encrypted fs
于 2013-02-04T11:26:01.723 回答
15

警告

来自@sidharth:“导致我的熔岩虹膜阿尔法进入引导循环:(”


对于运行 Android Marshmallow 6.0.1 的摩托罗拉 Nexus 6,我做了:

adb devices       # Check the phone is running
adb reboot bootloader
# Wait a few seconds
fastboot devices  # Check the phone is in bootloader
fastboot -w       # Wipe user data
于 2016-09-06T20:44:47.050 回答
13

我已经从快速启动模式(手机 - Xiomi Mi5 Android 6.0.1)

以下是步骤:

# check if device available
fastboot devices
# remove user data
fastboot erase userdata
# remove cache
fastboot erase cache 
# reboot device
fastboot reboot
于 2017-02-25T22:00:33.290 回答