This guide explains how to bypass a forgotten lock screen on an Android phone using a USB connection and a computer. It covers the main methods that work on most current devices, including using Android Debug Bridge (ADB) to remove the lock screen file, or using Samsung’s Smart Switch for older Samsung models. Before starting, you need a Windows, Mac, or Linux computer, a USB cable, and possibly the phone’s Google account credentials. Note that these methods are for your own device only; bypassing someone else’s phone is illegal.
What You’ll Need
- A computer (Windows, Mac, or Linux) with internet access
- A USB cable that supports data transfer (not just charging)
- The Android phone that is locked
- For ADB method: USB debugging must have been enabled before the phone got locked (usually in Developer Options). If it wasn’t, this method won’t work.
- For Samsung method: A Samsung phone with Android 5.0–9.0 (Android 10+ no longer works with this trick)
- Backup of your data (if possible) because some methods erase the phone
Step-by-Step
Method 1: Using ADB (if USB debugging was enabled)
- Install ADB on your computer. Download the Android platform-tools (from the official Android developer site) and extract the folder. On Windows, you may need to install the proper USB drivers for your phone.
- Open a command prompt or terminal in the platform-tools folder. On Windows, Shift+right-click inside the folder and choose “Open command window here” or “Open PowerShell window here”.
- Connect your locked phone to the computer via USB. If the phone asks for permission to allow USB debugging, you cannot proceed because you can’t tap “Allow” on the locked screen. If you previously checked “Always allow from this computer”, it may work.
- Verify the connection. Type
adb devicesand press Enter. If you see a device with “unauthorized” status, you cannot continue. If you see “device”, you’re good. - Remove the lock screen file. Type the following command and press Enter:
adb shell rm /data/system/gesture.key(for pattern lock) oradb shell rm /data/system/password.key(for PIN/password). On newer Android versions, also try:adb shell rm /data/system/locksettings.dbandadb shell rm /data/system/locksettings.db-walandadb shell rm /data/system/locksettings.db-shm. - Reboot the phone. Type
adb rebootand press Enter. The phone will restart. - Unlock the phone. After reboot, the lock screen should be gone or you can draw any pattern (it will accept anything). If it still asks for a PIN, try entering any random PIN – it might work. If not, you may need to proceed to a factory reset.
Method 2: Samsung Smart Switch (for older Samsung phones)
- On your computer, download and install Samsung Smart Switch from the official Samsung website.
- Open Smart Switch. Click on “More” (three dots) in the top-right corner, then select “Preferences”.
- In Preferences, go to “Backup” and uncheck all items except “Contacts” and “Messages” (actually, you can leave all unchecked, but the trick requires at least one item to be selected).
- Connect your locked Samsung phone to the computer via USB. Smart Switch should detect it.
- Click “Backup” in Smart Switch. It will start backing up the selected items. Wait for it to finish (it may take a few minutes).
- After backup completes, click “Restore” in Smart Switch. It will restore the backup to the phone. This process overwrites the lock screen settings, effectively removing the PIN/pattern.
- Disconnect the phone and restart it. The lock screen should be gone. If it still asks for a PIN, try a factory reset (see Troubleshooting).
Method 3: Factory Reset via Recovery Mode (last resort)
- Turn off the phone.
- Boot into Recovery Mode. The key combination varies by brand: For most Samsung phones: Press and hold Volume Up + Power (or Volume Up + Home + Power on older models). For Google Pixel: Press and hold Volume Down + Power, then select “Recovery Mode”. For other brands (LG, Motorola, etc.): Usually Volume Down + Power, or Volume Up + Power. Search online for your exact model.
- Use the volume keys to navigate to “Wipe data/factory reset” and press the Power button to select it.
- Confirm the reset by selecting “Yes” when prompted.
- After the reset, select “Reboot system now”. The phone will restart with no lock screen, but all data will be erased.
Common Mistakes
- Not enabling USB debugging before the lock: The ADB method only works if USB debugging was already turned on. If not, you’ll get “unauthorized” and cannot proceed.
- Using a charge-only cable: Some USB cables only carry power, not data. Use the cable that came with the phone or one known to support data.
- Incorrect ADB command: Typing the wrong file name (e.g., gesture.key on a PIN lock) may not remove the lock. Use the correct file for your lock type.
- Not backing up data before factory reset: A factory reset erases everything. If you didn’t back up, you’ll lose all photos, contacts, and apps.
- Assuming Smart Switch works on all Samsung models: This trick only works on Android 5.0 to 9.0. On newer models, Smart Switch won’t bypass the lock.
Tips
- Check if your phone has “Smart Lock”: If you had Smart Lock set up (e.g., trusted place or device), it might unlock automatically when in a trusted location or connected to a trusted Bluetooth device. Try that before any other method.
- Use Google’s “Find My Device”: If your phone is linked to a Google account, you can go to google.com/android/find on a computer, select your device, and choose “Erase Device”. This will factory reset it remotely (requires internet and the phone being turned on).
- Keep ADB installed for future: If you often forget your lock, enable USB debugging and keep the ADB commands handy. It can save you from a factory reset.
- For Samsung, try “Find My Mobile”: Samsung’s own remote unlock service (findmymobile.samsung.com) can unlock your phone if you have a Samsung account and had enabled “Remote unlock” before.
Troubleshooting
- ADB says “unauthorized”: This means USB debugging is on but you haven’t approved the computer. Since you can’t unlock the phone, you cannot approve. The only option is a factory reset (Method 3) or using the manufacturer’s remote unlock service.
- ADB command says “not found” or “permission denied”: Make sure you typed the command exactly. If you get permission denied, try running the command as administrator (Windows) or with sudo (Mac/Linux). Also, ensure the phone is not in “Charge only” USB mode – you may need to change it, but that requires unlocking.
- Smart Switch doesn’t detect the phone: Install the Samsung USB drivers on your computer. Also, try a different USB port or cable. If the phone is in “Download mode” or “Recovery mode”, Smart Switch won’t see it.
- After removing lock files, the phone still asks for PIN: On some Android versions, the lock screen is stored in a database that also needs to be removed. Try the additional commands (locksettings.db, etc.) or do a factory reset.
- Factory reset doesn’t remove the lock (FRP): After a reset, Android may ask for the Google account that was previously on the phone (Factory Reset Protection). If you don’t know the credentials, you’ll be stuck. You may need to contact the device manufacturer or your carrier for help.
Frequently Asked Questions
Will these methods erase my data?
The ADB method (if it works) does not erase data. The Smart Switch method also preserves data. A factory reset will erase everything. Remote erase via Find My Device also wipes data.
Can I unlock a phone that is locked to a specific carrier?
Carrier lock is different from screen lock. These methods only bypass the screen lock. If the phone is carrier-locked, you need to contact the carrier to unlock it, which usually requires the account holder’s permission.
What if I never enabled USB debugging?
Then the ADB method won’t work. Your only options are a factory reset (which triggers FRP) or using the manufacturer’s remote unlock service (if available). For Samsung, you can try Smart Switch only if your model is old enough.
Is it legal to unlock a phone this way?
It is legal to unlock your own phone. Unlocking someone else’s phone without permission is illegal and unethical.
Why does the factory reset still ask for a Google account?
This is Factory Reset Protection (FRP), a security feature that prevents thieves from using a reset phone. You need the Google account credentials that were on the phone before the reset. If you don’t have them, you’ll need to contact the manufacturer or carrier for help.
Can I use these methods on a phone with a broken screen?
If the screen is broken but the phone is on, the ADB method might work if USB debugging was enabled and you can still unlock via a USB mouse (using OTG). Otherwise, a factory reset via recovery mode is possible, but you’ll lose data.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Payday 2 Crash Issues on PC: A Step-by-Step Guide
- Remove a Remote Access Trojan from Windows PC
- Google Pixel & Pixel XL: How to Turn Off Snooze
- Facebook as AIM Messenger: Step-by-Step Guide
- iPhone 17 SOS Service Issue: How to Fix It
- Install VLC Extensions on Linux