Did you ever want to know How To Enable ADB Over USB TWRP? Of course, you did. Isn’t that why you’re here? Well, the OnXshadow team is here for your rescue and will provide the answer to your question. But, along with that, we also have so many other queries and questions we will answer so that you never face any other issue with ADB again.
If you are new, don’t worry. We will begin from the beginning. For example, what is ADB, and what does ADB stand for? How can you use it? What issues are you facing with ADB and why might that be happening?
ADB (adb) stands for Andriod Debug Bridge. As the name suggests, it is a handy tool that helps you communicate with the device to a great extent. The tool is also helpful in actions like installing or debugging any app.
Well, this should be all for the beginning, let’s move on to the in-depth article and explanations. Shall we?
What Is ADB Sideload?
As we spoke about what is ADB, we must also talk about ADB Sideload. So, what is ADB Sideload?
ADB sideload is a new feature that was added to AOSP recovery in Jelly Bean. As of version 2.3, TWRP now supports ADB sideload mode. ADB sideload is a different ADB mode that you can use to push and install a zip using one command from your computer. Most likely ADB sideload won’t be very useful for your average recovery user, but ADB sideload can be a huge time-saver for a ROM developer.
-Via twrp.me
How Can I Use ADB Sideload?
Having an idea of what ADB Sideload is if you are now wondering how can you use ADB sideload, here is a guide for you.
- First, install a recovery in your device that supports the sideload like TWRP versions 2.3 or higher.
- Have the latest ADB Binaries installed on your computer. You can get the latest ADB Binary from Platform-tools from the Android SDK.
- Version 1.0.29 or higher is required.
- Once you’re done with this, turn the device’s settings into “ADB Sideload” mode.
- If you’re using TWRP, you can do this from “Advanced > ADB Sideload.”
- Now, from the Command line, type adb sideload /path/to/rom.zip
And, you’re good to go!
Notes:
For TWRP Versions Lower Than 2.8.2.0:
Regardless of the existing storage location you have chosen on your device on the mount page, the file will be copied there. Also, remember that the file will be placed in the root storage and named ‘sideload.zip’.
The file will also overwrite or delete any other files by the same name.
After the file is copied to your device, it will immediately begin to install itself. When the installation is complete, a button to reboot the system will be displayed, allowing you to do so and test your package.
For TWRP Versions Higher Than 2.8.2.0:
TWRP Versions higher than those mentioned above will stream the zip file from your PC without downloading it to your device.
Definitely avoid using sideload if you wish to download the file to your device.
How To Enable ADB Over USB TWRP?
We are pretty sure that you will be aware but, here it is: TWRP stands for TeamWin Recovery Project.
It is also a Canadian rock band that was formed in 2007 known as the Tupper Ware Remix Party (but we don’t need to talk about that here.)
Now, let’s talk about how to enable ADB Over USB TWRP.
While trying to enable ADB over USB TWRP, make sure you have the following conditions met:
- You have stock recovery and a rooted phone
- you have custom recovery.
The Changed Files will be:
- /system/build.prop
- /data/property/persist.sys.usb.config
- /data/misc/adb/adb_keys
The process is essentially 2 steps. But, the catch is that there are little steps in between you have to follow and keep in mind.
The first step is to enable USB debugging. You can do that by: Settings > Developer Options >USB Debugging ON.
- Now, connect your android device to your PC.
- Open cmd on the computer and go to program-tools/
- Type and enter: adb devices. This checks if your device has been connected successfully in recovery mode.
- Type this command: adb shell mount data and adb shell mount system
- Now use the adb pull/data/property/persists.sys.usb.config/your directory to get the persist.sys.usb.config file.
- Now open the text editor that you use/have been using and edit it to mtp,adb.
- Save it.
- Now it’s time to push the file back to the device again. Use this command to do so: adb push/your-directory/persist.sys.usb.config/data/property
- Next, go to the build.prop file: adb pull/system/build.prop/your-directory.
- Add these commands:
- persist.service.adb.enable=1
- persist.service.debuggable=1
- persist.sys.usb.config=mtp,adb
- It’s time now to push back the build.propback to the device. You can do that by using the command: adb push/your-dir/build.prop/system
The second step is to get RSA Verification.
Phewwww finally we’re done!
Why Does ADB not Recognize My Device In Recovery Mode?
If ADB cannot recognize your device in recovery mode, there can be a number of reasons for that to happen.
One reason could be that your device might not have been found in the first place.
But if it is and your adb is still not recognizing your device, you should install “Google USB Driver”. This should help you in this case.
Below is the step description:
Google USB Driver > Device Manager > Device (right click) > Update Drive’s Software > Browse My Computer > Let me Pick > Android Device > Android ADB Interface
How To Fix or Enable ADB and MTP in TWRP Recovery?
If you are not able to enable ADB and MTP I’m TWRP recovery, OnXshadow is here to help. Below is a quick guide to let you know how to fix/enable ADB and MTP in TWRP Recovery.
Make sure you have the following requirements met:
- TWRP Recovery
- Notepad++
- Android Image Kitchen
How to Fix/Enable ADB and MTP in TWRP Recovery:
- Use the AIK Tool and extract your TWRP recovery.img (you can use the AIK tool by dragging and dropping onto the unpacking.bat)
- If this doesn’t work out, open \ramdisk and edit the file using the text editor (notepad++)
- If you have android 8 and above, edit prop.default
- If you have android 7 and below, edit default.prop
- Search for the following values given in the table. If you find them, change them. to the values in front of them. If you don’t, then add the values in the Code 2 section.
Code 1 | Code 2 |
ro.secure | ro.secure=0 |
ro.adb.secure | ro.adb.secure=0 |
ro.debuggable | ro.debuggable=1 |
persist.sys.usb.config | persist.sys.usb.config+adb,mtp |
sys.usb.config | sys.usb.congif=adb,mtp |
- Run the repackimg.bat script to repack the TWRP.
- Next, verify that both ADB and MTP function after flashing and booting into TWRP.
How To Enable USB Debugging Using a Computer?
Enabling USB Debugging using a Computer might not be the easiest task ever especially when you are not well-versed or new to coding.
But you can debug your android app or device using USB. Follow the steps and voíla!
- The first step is to enable USB Debugging on your phone (android).
- if you have Android version 4.1 or lower, you will see the developer options screen by default.
- However, if you have an android version 4.2 or higher, follow Settings app > System > About Phone > Tap Built Number (7 times) > Previous screen > Developer options > Enable USB Debugging
- Next, install Java SE SDK 8 Update 152
- Configure Android SDK
- Now, lastly, configure Google Chrome for debugging
You can find an in-depth article about it here.
How Do I Enable USB Debugging Using ADB?
Here is an intrinsic guide on how to enable USB Debugging Using ADB:
- Enable the device’s recovery mode.
- Download the SDK platform tools.
- Extract the .zip file into the PC.
- Inside the extracted folder, find the “Platform Tools” folder.
- To open a new command window, click the File option in the top left corner and choose “Open Windows PowerShell”.
- Type “adb devices” and press enter. If you see the Device ID in alphanumeric numbers, then ADB will be able to recognize the device in recovery mode.
- To mount the necessary directories, execute the following commands and hit Enter after each one.
- adb shell
- $ mount data
- $ mount system
- From the phone to the computer, transfer the “persist.sys.usb.config” file. You can do this by using the command: adb pull /data/property/persist.sys.usb.config C:\Users\[]\Desktop\
- You can also edit the “persist.sys.usb.config” file. Here’s how: Right click > Select the text editor > add “mtp,adb” options you have > push it back using the command: adb push “C:\Users\[]\Desktop/persist.sys.usb.config” /data/property
- Open the “build.prop” file using the exact editor as before.
- Add the following to the file:
- persist.service.adb.enable=1
- persist.service.debuggable=1
- persist.sys.usb.config=mtp,adb
- Save it. Use the command given to push it back: adb push “C:\Users\[]\Desktop/build.prop” /system/
- Reboot the device using the command “adb reboot”.
This is how you enable USB Debugging Using ADB.
How To Enable USB Debugging in Download Mode?
Unfortunately, there isn’t much hope if you forgot to enable USB Debugging before the device got into download mode.
But, if you know, or have found a solution to do that, please mention it in the comments below or mail it to us.
Frequently Asked Questions | How To Enable ADB Over USB TWRP?
Now let’s move towards the frequently asked questions by our readers:
1. How To Use ADB to Install TWRP?
Here is a quick guide to installing TWRP using ADB:
- Download the latest TWRP recovery.img
- rename recovery filename to twrp.img
- copy recovery.img to C:\Program Files\Minimal ADB
- Connect the android device to the PC using a USB.
- Go to the above location and press the shift key + right mouse to click on the empty space.
- Click on Open command window here to launch the command prompt window (cmd) on your PC.
- To check whether your device has been successfully connected to the PC, type the command: adb devices and press enter. You will see a list of devices that have been connected to your PC.
- Now boot the android device using the command in the cmd window: adb reboot bootloader.
- You will get a permission pop-up on your device. Tap OK.
- Type the command “fastboot devices” to confirm if the fastboot is functioning or not.
- You will see the list of attached devices and hence confirm that the fastboot was a success.
- Now, to install TWRP recovery, type in the following command and press enter:
fastboot flash recovery twrp.img
It will just take a few seconds. To finally wind up the whole process, type in the following command: fastboot reboot
And here you go. You have successfully installed TWRP using ADB!
2. How Do I Enable USB Debugging in Recovery Mode?
Well, if you forgot to enable USB Debugging from the settings and went directly to recovery mode, let’s see now how you can enable USB Debugging in Recovery mode.
Requirements:
- Stock ROM
- SuperSU
- Notepad++
- WinRAR
Method:
- Unzip the stock ROM. There, find system.img and extract it as well.
- Extract Update-SuperSU.v1.65.zip file.
- Go to the folder where system.img is extracted.
- Take any file with .apk extension and change it to .zip.
- Copy the RSA Certificate and copy it to Update-SuperSU.v1.65 folder.
- Now, copy builder.prop file after you add this at the bottom: persist.service.adb.enable=1
Yay! you did it!!
Conclusion | How To Enable ADB Over USB TWRP?
Well, it might be a little tiresome, but the end result is totally worth it! We hope this article was helpful in one way or the other to you. Do let us know if you want to know something more about this topic from us. We will keep a look at what you want to know and serve it.
Also check out the other posts linked below: