Have you forgotten the password for your Androidsmartphone, and USB debugging was disabled? Or is the device stuck at the logo after an unsuccessful update, and the only way to save the data is to connect via ADB? In such cases, standard methods for activating developer mode are not available, but there is a way out: enable debugging via USB debugging recovery (recovery mode).

This method works even on completely locked devices where it is impossible to enter the settings. We will analyze step-by-step guide for Samsung, Xiaomi, Huawei and other popular brands, explain what tools you will need, and warn about possible risks. Important: the method requires the presence of custom recovery (for example, TWRP) or access to stock recovery with support ADB sideload. If you have a standard recovery without additional functions, read alternative solutions at the end of the article.

Why standard methods of enabling debugging do not work

Under normal conditions USB debugging activated through the menu Settings โ†’ About phone โ†’ Build number (7 taps) and further in Developer options. But if:

  • ๐Ÿ”’ The screen is locked with a password, pattern or fingerprint;
  • ๐Ÿ“ฑ The device does not boot beyond the logo (bootloop);
  • ๐Ÿ”„ The settings have been reset and debugging is disabled automatically;
  • ๐Ÿ› ๏ธ The smartphone is โ€œbrickedโ€ after the firmware,

โ€”then the standard path is not available. This is where recovery comes to the rescue - an alternative boot mode that allows you to control the device at a low level. However, not all recoveries support the necessary functions. For example, stock recovery from Samsung or Huawei is often limited to basic options like resetting data.

Key difference custom recovery (for example, TWRP or OrangeFox) - the presence of a terminal ADB, the ability to mount partitions and edit system files. It is through them that you can manually enter debugging parameters in a file build.prop or download a modified one settings.db.

๐Ÿ“Š What recovery is installed on your device?
Stock (from the manufacturer)
TWRP
OrangeFox
Other custom recovery
Not I know

What you will need to enable debugging through recovery

Before you start, prepare:

  • ๐Ÿ–ฅ๏ธ Computer with Windows, Linux or macOS;
  • ๐Ÿ”Œ Cable USB Type-C/Micro-USB (original, without damage!);
  • ๐Ÿ“ฆ Installed drivers ADB i Fastboot (you can download from official Android website);
  • ๐Ÿ“ฑ Unlocked bootloader (bootloader) - for most brands, except Xiaomi and some models Samsung;
  • ๐Ÿ› ๏ธ Custom recovery (for example, TWRP) - if the stock recovery does not support ADB.

If you have a stock recovery, check if it contains the item Apply update from ADB or ADB sideload. On some devices (for example Google Pixel or OnePlus) this option is present by default. For the rest, you will need to first install TWRP.

โš ๏ธ Attention: On devices with a locked bootloader (for example, Huawei or Sony), installation custom recovery is impossible without unlocking. This will lead to a complete data reset!

Also prepare:

  • ๐Ÿ“„ A backup copy of important data (if the device somehow turns on);
  • ๐Ÿ”‹ Battery charge at least 50% - to avoid sudden shutdown;
  • ๐Ÿ” Information about the device model and version Android (can be found through fastboot getvar all).

Install ADB and Fastboot on the PC|

Download the firmware or modified settings.db (if required)|

Check for custom recovery|

Disable the antivirus (it can block ADB)|

Connect the phone to the PC and make sure that it is detected in Device Manager-->

Step-by-step guide for devices with TWRP

If your smartphone has TWRP or another custom recovery supported ADB, follow these steps:

  1. Turn off the device. data-i="109">(or on older models); mount the partition).

    • ๐Ÿ“ฑ Samsung: Power + Volume Up + Bixby (or Home on older models);
    • ๐Ÿ“ฑ Xiaomi/Redmi: Power + Volume Up;
    • ๐Ÿ“ฑ Google Pixel/OnePlus: Power + Volume Down, then select item Recovery Mode.
  • On the menu TWRP select Advanced โ†’ File Manager (or Mount โ†’ System, if you need to mount the partition).

  • Navigate to the path /data/data/com.android.providers.settings/databases/ and find the file settings.db. Make a backup copy of it (copy it to an SD card or PC via ADB pull).

  • Open the file settings.db in any editor SQLite (for example, DB Browser for SQLite). Find the table secure and add the line:

    INSERT INTO secure (name, value) VALUES ('adbd', '1');

    If the line already exists, change its value to 1.

  • Save the file and return it to the device, replacing the original. Reboot into the system.

  • After the reboot USB debugging will be enabled automatically. Connect the device to the PC and check availability with the command:

    adb devices
    โš ๏ธ Attention: On some firmware (for example, MIUI or EMUI), after such manipulations the protection may work Anti-Rollback, which will lead to blocking of the device Before editing settings.db Make sure the firmware version is compatible!
    ๐Ÿ’ก

    If editing settings.db seems difficult, you can use a ready-made modified file for your model. They are often posted on forums like XDA Developers or 4PDA.

    Alternative method: editing build.prop

    If access to settings.db is impossible (for example, due to partition encryption /data), you can try enabling debugging via file build.prop. This method is less reliable, but sometimes. works on older versions Android (up to 9.0).

    1. In TWRP go to Mount โ†’ System (if the partition is not mounted).

    2. Open the file /system/build.prop in a text editor ( TWRP has a built-in editor).

    3. Add the following lines to the end of the file:

      persist.service.adb.enable=1
      

      persist.service.debuggable=1

      persist.sys.usb.config=mtp,adb

    4. Save the changes and reboot the device.

    After reboot, check if the device appears in the list adb devices. If not, return to the method with settings.db.

    Method Requires root Works on encrypted /data Risk of failure
    Editing settings.db No No (requires access to /data) Medium (may break settings)
    Change build.prop No Yes Low (but ineffective on new Androids)
    Installing Magisk (ADB module) Yes Yes High (requires unlocking the bootloader)

    Features for different brands

    The process of enabling debugging through recovery may vary depending on the manufacturer. Let's consider the nuances for popular brands:

    Xiaomi/Redmi/POCO

    On devices with MIUI protection Anti-Rollbackis often used, which blocks changes to settings.db. Alternative method:

    1. Install TWRP for your model (for example, through fastboot flash recovery twrp.img).
    2. In recovery, select Mount โ†’ Data and format the partition (this will delete all data!).
    3. Download modified settings.db for MIUI (search on 4PDA according to the device model) and replace the original file with it.

    Samsung

    On most devices Samsung stock recovery does not support ADB. Solution:

    • ๐Ÿ”ง Install TWRP via Odin (requires an unlocked bootloader).
    • ๐Ÿ“ Use the method with build.prop, like this how /data on Samsung is often encrypted.

    Huawei/Honor

    Devices Huawei s Kirin-processors have a closed bootloader. If it is locked:

    • ๐Ÿ”“ Unlock the bootloader through the official service Huawei (unlock code required).
    • ๐Ÿ“ฅ Install TWRP for Kirindevices (for example, OrangeFox).
    • ๐Ÿ› ๏ธ Use the method with settings.db, but be prepared to reset the data.
    โš ๏ธ Attention: On devices Huawei with EMUI 10+ and newer editing settings.db can lead to activation eRecovery and a forced reset!

    Frequent errors and how to avoid them

    When enabling debugging through recovery, users often encounter the following problems:

    • ๐Ÿšซ The device is not detected in adb devices:

      Check the drivers, try a different cable or USB port. On Windows sometimes installing drivers manually through Device Manager helps.

    • ๐Ÿ”’ Cannot mount /data:

      If the partition is encrypted, try entering the password in TWRP (item Mount โ†’ Data โ†’ Decrypt Data). On some firmware this is not possible - you will have to format /data (data loss!).

    • ๐Ÿ“‰ After the changes, the device froze:

      Return to recovery and undo the edits in build.prop or settings.db. If the system does not boot, reset via Wipe โ†’ Factory Reset.

    • ๐Ÿ›ก๏ธ Protection triggered Anti-Rollback:

      On Xiaomi this leads to blocking of the device. The only solution is to flash the official firmware via Mi Flash Tool with clearing all data.

    On devices with Android 12+ and higher, editing settings.db can lead to resetting all settings during the next system update. Scoped Storage.

    What to do if nothing helps?

    If none of the methods worked, radical measures remain:

    1. Flash the modified firmware with debugging already enabled (search on thematic forums).

    2. Use exploits like DirtyCOW (works on Android 7-10, but requires technical skills).

    3. Contact the service center โ€”some workshops can enable debugging via JTAG or ISP, but it is expensive (from 3,000 rubles).

    Security: risks and how to minimize them

    Enabling USB debugging via recovery is a powerful tool, but it is fraught dangers:

    • ๐Ÿ•ต๏ธ Attack vulnerabilities: If debugging is enabled, an attacker with physical access to the device can steal data via ADB.
    • ๐Ÿ”ง Violation of system integrity: Improper editing build.prop or settings.db can lead to bootloop.
    • ๐Ÿ“ต Loss guarantees: Unlocking the bootloader and installation custom recovery void the warranty of most brands.

    How to reduce risks:

    • ๐Ÿ” After solving the problem disable debugging with the command:
      adb shell settings put global adb_debug 0
    • ๐Ÿ“ฑ Set a strong password on the device and turn it on encryption.
    • ๐Ÿ›ก๏ธ Use Magisk to hide the root status from applications (if installed TWRP).
    โš ๏ธ Attention: On devices with Samsung Knox (for example, Galaxy S/Note) any manipulations with the recovery lead to flag trigger Knox 0x1which blocks operation of Samsung Pay, Secure Folder and other functions.

    FAQ: Answers to frequently asked questions

    Is it possible to enable debugging through recovery without TWRP?

    Yes, but only if the stock recovery supports it. ADB sideload. For example, on Google Pixel or OnePlus you can load a modified settings.db via the command:

    adb sideload settings.db

    However, this will only work if the partition /data is not encrypted.

    Why after editing settings.db, debugging does not turn on?

    Probable reasons:

    • The file settings.db was damaged during editing;
    • The system ignores changes due to protection SELinux (try to temporarily disable it with the command setenforce 0);
    • The firmware uses an alternative mechanism for storing settings (for example, shared_prefs v Android 10+).
    How to enable debugging on a locked one iPhone?

    On iOS no analog ADB or recovery. The only way is to use vulnerabilities like checkm8 (for chips A5-A11), but this requires soldering work and specialized equipment.

    Is it possible to enable debugging via Fastboot?

    No, Fastboot does not provide access to system settings. However, you can flash it through custom recoveryand then enable debugging.

    What to do if the device does not turn on after the changes?

    Follow the following steps:

    1. Boot into recovery (TWRP or stock).
    2. Delete or return original files build.prop and settings.db.
    3. Run Wipe โ†’ Factory Reset (if you are not afraid to lose data).
    4. Flash the stock firmware via Fastboot or Odin (for Samsung).
    ๐Ÿ’ก

    If your device does not have custom recovery and is locked, the only reliable way to enable debugging is to contact a service center. Independent attempts on stock recovery most often end in a complete data reset.