Hot answers tagged

50 votes
Accepted

How do I get my device detected by ADB on Linux?

Enable USB debugging on the device This is done in Settings › Development. If you don't have that entry in your settings menu, go to Settings › About, scroll to the "Build number", and ...
Izzy's user avatar
  • 91.1k
45 votes

Is there a way to see the device's screen *live* on PC, through ADB?

screenrecord screenrecord is an internal Android executable that dumps screen to a file, and ffplay from ffmpeg happens to be able to play an H.264 encoded stream from stdin First enable ADB USB ...
Ciro Santilli OurBigBook.com's user avatar
35 votes

How to set WIFI proxy via adb shell?

On my Android 7 and 8 devices: adb shell settings put global http_proxy <address>:<port> Seems the setting is lost at reboot, however.
Malcolm Crum's user avatar
34 votes
Accepted

What is this `adb` utility I keep getting advice to use?

About adb To put it shortly, adb (Android Debug Bridge) is a utility made to be installed on a computer, in order to let it gain a shell on a phone that's either connected via USB cable, or on the ...
Grimoire's user avatar
  • 2,969
34 votes
Accepted

Does adb backup/restore still work because it says it's deprecated?

Deprecated means it is fully functional but may be removed in future versions. Google of course prefers that their cloud is used so that they still control access to the backup data. The only part ...
Robert's user avatar
  • 19.8k
30 votes

Is it possible to backup and restore an app with data via ADB?

The answer is: It depends. It's the way supposed to work: adb backup -f myapp.ab -apk com.myapp # backup on one device adb restore myapp.ab # restore to the same or any other device ...
Izzy's user avatar
  • 91.1k
28 votes

Samsung (Galaxy S4) does not show Authorize USB debugging dialog box

I have had this happen multiple times on multiple Android devices. Solved every time by putting the device in Photo transfer (PTP) mode. ADB will not work for me when my device is in MTP or any other ...
Chuck Renner's user avatar
27 votes

How can I shutdown my Android phone using an adb command?

Note: All the following commands below require root access. On Android Oreo, this works and does a graceful shutdown: adb shell su -c 'am start -a com.android.internal.intent.action.REQUEST_SHUTDOWN' ...
Firelord's user avatar
  • 25.1k
27 votes
Accepted

How to recover a deleted file from /data partition on a rooted phone?

First to clarify root and data: Root directory / of Android devices is a read-only pseudo (temporary) filesystem (rootfs) that lives in RAM and is vanished when device is powered off. When device is ...
Irfan Latif's user avatar
  • 20.2k
26 votes
Accepted

How to reinstall an uninstalled system app through ADB?

Technically, the command adb shell pm uninstall -k --user 0 <package_name> does not uninstall an app from the device. Instead, it just removes it from a user. There are a couple of ways to get ...
Bo Lawson's user avatar
  • 2,578
25 votes

How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)

I succeded adding the -k and --user options to the pm command, e.g.: pm uninstall -k --user 0 com.android.service The command was issued as root, no need to remount /system as rw. Android on the ...
RigacciOrg's user avatar
22 votes

Enable and disable system apps via ADB

This should work regardless whether the app is a system app or a third-party app (user installed). See my answer at Determine the package name of your app to get the package name of the concerned app ...
Firelord's user avatar
  • 25.1k
22 votes

Why doesn't Huawei provide just the USB driver to use ADB?

Drivers are not distributed as standalone package in order to increase market penetration of the HiSuite software. It's quite popular marketing strategy: you can get what you want only in bundle with ...
Agent_L's user avatar
  • 321
19 votes

Enable location services via ADB or shell

On Android 6.0, To enable: GPS: adb shell settings put secure location_providers_allowed +gps Network: adb shell settings put secure location_providers_allowed +network To disable: GPS: adb shell ...
Aditya S's user avatar
  • 191
19 votes
Accepted

adb push not working on /system, read only

The sequence of commands that worked for me was adb root adb disable-verity adb reboot adb root adb remount If I don't reboot, remount does not succeed.
user13107's user avatar
  • 411
18 votes

Is there a way to backup contents of internal SD, while preserving the file's modification date?

Try using the -a option to copy all file attributes: adb pull -p -a /sdcard/ (The -p is for progress indication.)
Michael Huang's user avatar
18 votes

how to adb wait-for-device until the home screen shows up?

This is an old question and borderline off-topic but here is how to do it in a single line: adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent ...
Пионерка's user avatar
16 votes
Accepted

Using ADB to change the screen lock

Since Android 8.0 Oreo, you can change the lock screen using below adb commands adb shell athene_f:/ $ locksettings usage: locksettings set-pattern [--old OLD_CREDENTIAL] NEW_PATTERN ...
Rk215 Tech's user avatar
16 votes

ADB backup creates 0-byte file; prompts for current backup password even though I never set one; "Failed to set password" for Desktop backup password

Building on kevenoid's answer, it may depend on what version of adb is running on the phone. You can find out what version the phone is running natively by doing the following: First find out what ...
KroniK907's user avatar
  • 261
16 votes
Accepted

Can't use chmod to alter permissions on emulated phone

Figured it out - seems like you just can't change permissions for files on sdcard. Moved it to data/local and chmod worked like a charm.
Rachel L's user avatar
  • 341
16 votes
Accepted

disconnect adb of device connected over TCP does not work

I just use "adb disconnect" and it worked fine for me. See the photo below:
Van Thuan Pham's user avatar
16 votes

Factory reset Android using ADB

You need: Minimal ADB & Fastboot which contains ADB executable then unzip the file ADB drivers and install them A computer Steps: Open the folder where Minimal ADB & Fastboot is, launch it. ...
esQmo_'s user avatar
  • 3,207
16 votes
Accepted

Android O, failed to mount /system, /dev/block/dm-0 is read only

For debug build, user have to disable-verity at first. adb root adb disable-verity adb reboot adb remount adb shell mount -o rw,remount /system In order to know build type of your android, in adb ...
hellojoshhhy's user avatar
16 votes

Device not shown on ADB even after pairing for wireless debugging on Linux

As per the official documentation (snapshot of 22 January 2022), after pairing the device, the user still needs to manually connect the device (For Linux or Microsoft Windows only) Run adb connect ...
Andrew T.'s user avatar
  • 16k
15 votes

How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)

Also works without -k (keep user settings) option: pm uninstall --user 0 com.android.service and without opening adb shell: adb uninstall --user 0 com.android.service
Andrei Karcheuski's user avatar
15 votes

How to remove the SIM Toolkit from my phone? (Without root or flashing any ROM)

Connect Your Phone to PC Using Data Cable. Turn on USB Debugging Setup ADB Connection Type adb shell Hit Enter and type again this pm uninstall -k --user 0 com.android.stk or pm uninstall -k ...
zatokaa's user avatar
  • 282
15 votes
Accepted

Why does "adb root" do nothing?

On production — user build of a ROM — you can't start adbd as root unless ROM or at least adbd binary is rebuilt with required modifications. Reason is the ALLOW_ADBD_ROOT build flag (1, 2). That's ...
Irfan Latif's user avatar
  • 20.2k
14 votes
Accepted

adb listing all forwarded ports

I think a new command has been added since the earlier answers: adb forward --list
crouleau's user avatar
  • 156
14 votes
Accepted

How to check if a package is enabled via shell?

pm list packages -d 2>/dev/null will list up all disabled packages, one per line, preceded with the keyword package: – so output looks like package:com.android.exchange package:com.android.email ...
Izzy's user avatar
  • 91.1k

Only top scored, non community-wiki answers of a minimum length are eligible