Вы находитесь на странице: 1из 1

7/27/2016 adbHowtoenableUSBDebugginginAndroidifforgottenpatternforscreenunlock?


signup login tour help

Android Enthusiasts Stack Exchange is Here's how it works:
a question and answer site for
enthusiasts and power users of the
Android operating system. Join them; it
only takes a minute:
Anybody can ask Anybody can The best answers are voted
Sign up a question answer up and rise to the top

How to enable USB Debugging in Android if forgotten pattern for screen-unlock?

I want to use some third party software to clear my device's screen unlock pattern which I forgot. They require USB debugging enabled but I don't have it
enabled in my Android.

How do I turn on USB Debugging through Recovery mode, or Fastboot?

adb recovery-mode fastboot usb-debugging

edited Jun 11 '15 at 8:41 asked Jun 10 '15 at 12:45

Firelord Jenabictak
10.2k 8 29 77 43 1 1 4

3 As it turns out, this again seems to be an XY problem. Instead of trying to get your supposed solution working
(enabling USB debugging), your question should have included that you've locked yourself out and forgot the PIN.
Completely different issue, covered e.g. in our locked-out tag-wiki. Please start reading there. If you cannot x your
issue with those hints, ask a new specic question including what you've tried, where you're stuck, your device and
Android version. Good luck! Izzy Jun 10 '15 at 18:18

2 Answers

Details for that can be found in our usb-debugging tag-wiki (where I've just added them):

By default, USB debugging is disabled with stock ROMs (some custom ROMs however have
it enabled by default). To toggle it on or off, you can nd the corresponding switch in
Settings Development a section originally hidden with Android 4.2 and up. You can make
this section visible by going to Settings About device and "hammering" the entry telling
your ROM's build version until a toast-message congratulates you for having become a

If your issue is however that you cannot boot up your device normally, and thus cannot reach
the settings section described above, please take a look at the following questions:

How to backup broken screen phone when USB debugging IS NOT enabled?
Broken screen while debug mode was disabled. How can I re-enable adb?

answered Jun 10 '15 at 14:39

61.7k 27 153

tnx . but i know this . for example i forgot the pattern of my devices . i can issuse this whit 3rd softwere like shuami or
whit adb command . but both of them need usb debugging for remove pattern without remove les . if that is turn off
, my problem is Shine . must to enable it .how ? Jenabictak Jun 10 '15 at 16:39

2 That's why you should include as much details as needed with your question. How should anyone expect that? OK, I
did which is why I linked those two questions (please follow the links). Izzy Jun 10 '15 at 18:15

Based on OP's clarication done in the comments below Izzy's answer, I propose the following
solution if one's device is locked out and ADB is not enabled under Settings.

Note that this method is tested on Stock Android 4.2.1 and Stock CM 12.0 (Android 5.0) , both
devices having custom Recovery (ADB always enabled as default) . If your Stock Recovery
allows ADB shell access then you may also consider this solution.


1. You should try your pattern-cracking software (or whatsoever the genre it has) from inside
the Stock Recovery to see whether it works with the former's environment (ADB shell
available there or not).
2. Since I would never try step 1., I would do the following:

For Jellybean 4.2.1:

1. Boot into Recovery and mount Data partition.

2. Open a shell on PC and type:


Repace ~/ with home directory of your OS.

3. Open that le in a text editor and you would possibly see mtp written there. Change it
to mtp,adb .

Note that sometimes Android doesn't understand the text le changes if the line
terminator is "DOS Terminators" which Notepad would probably do on Windows (mine
is Linux so no issue here).

In that case, I would suggest not using adbpull but doing:


You may verify that the echo command overwrote the le by using:


and seeing the le's content in some text editor.

4. Unmount Data and reboot into Android OS. USB Debugging would probably be
For Lollipop 5.0:

JB 4.2.1 users can also follow this method if the previous one didn't work for them.
1. Boot into Recovery and mount Data partition.
2. Repeat step 2 and 3 used in JB 4.2.1 method.
3. We need to tweak some parameters in settings.db . Type:

4. Back it up at some other location too, and open the le in an SQLITE editor. I'm
running Linux and DB Browser for SQLite works well. It's also available for Windows
5. In the global table, change the value for:
adb_enabled to 1

development_settings_enabled to 1

6. Check that verifier_verify_adb_installs is set to 1 in the global table.

7. Check that as default, in the secure table:

adb_notify is 1

adb_port is 1
These checks in step 6 and 7 are not necessary but should be done so that
troubleshooting becomes rather easy if the solution doesn't work for you.
8. Save the changes in settings.db and copy it back into Android by typing:


That delete ( rm ) command is not necessary since adbpush should overwrite the le,
but I executed it for my peace of mind.
9. Unmount Data and reboot into Android OS. ADB probably would be enabled.

This is how it actually worked out when tested on my devices.

Source: Not really a source but got a hint from a comment under this answer.

edited Aug 10 '15 at 10:03 answered Jun 11 '15 at 5:59

10.2k 8 29 77

And I think that pattern (through le editing) can be cleared in this way without turning on the USB debugging in
Android. Don't know how though! Firelord Jun 11 '15 at 6:08

If adb isn't working (which I think is what this question is regarding), how do you use adb to pull/push les? PaulG
Feb 7 at 11:30

@PaulG: The setting about USB debugging that you see in Developer options, all it does is run or stop the adbd
daemon in the Android OS. When you're outside the Android OS, the settings in the environment you're booted into
governs whether adbd should be running or not. // A custom recovery is a different environment and TWRP and CWM
runs adbd per their default settings. That's what I noted in the second paragraph of the answer that a custom recovery
is needed. // Let me know if you're still unclear at some point. Firelord Feb 7 at 14:06

Do note that question doesn't say adb is not working, but that USB debugging is not enabled in the Android OS. Those
are two different things. Firelord Feb 7 at 14:10

Thanks guys. I was trying to avoid asking a new question as I had a similar quirk where I couldn't boot the device past
the bootloader (and so couldn't enable usb debugging). All resolved now PaulG Feb 7 at 14:58

protected by Community Dec 1 '15 at 19:55

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

http://android.stackexchange.com/questions/112040/howtoenableusbdebugginginandroidifforgottenpatternforscreenunlock 1/1