如何在 Android 中使用 adb 恢复出厂设置? [已关闭]

问题描述 投票:0回答:4

如何使用 ADB 命令在 Android 中恢复出厂设置?我使用了 adb restart recovery 命令来重置。但是第三方应用程序无法清除。使用ADB实现的正确方法是吗?

实际上,我想通过java代码将android设备恢复出厂设置。这里有什么解决办法吗?

android android-intent android-emulator android-widget
4个回答
93
投票

您可以在 adb 中发送意图MASTER_CLEAR

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

或作为 root

adb shell  "su -c 'am broadcast -a android.intent.action.MASTER_CLEAR'"

Android 8.0及以上版本,具有shell的root权限

am broadcast -p "android" --receiver-foreground -a android.intent.action.FACTORY_RESET

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

15
投票

警告

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


对于运行 Android Marshmallow 6.0.1 的 Motorola 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

14
投票

我已经从fastboot模式下完成了(手机 - 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
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.