43

After rooting my device, I need to run adb root and then adb shell so I could then access my applications database. When trying to run adb root I keep getting "adbd cannot run as root in production builds". Why is this? The only other option is to use the Android emulator for testing, but we all know how terrible the emulator is (not really a viable development solution).

2
  • Speaking of accessing your app's directory in /data/data, you can do that even on a fully stock and bootloader-locked device using the run-as <package> command in the adb shell provided your app has debuggable="true" in its manifest.
    – Grishka
    Aug 9, 2016 at 1:49
  • the (self-)accepted answer does not solve the title problem. For that see stackoverflow.com/q/25477424/1778421
    – Alex P.
    Jul 5, 2017 at 18:56

1 Answer 1

54

I finally found out how to do this! Basically you need to run adb shell first and then while you're in the shell run su, which will switch the shell to run as root!

$: adb shell
$: su

The one problem I still have is that sqlite3 is not installed so the command is not recognized.

6
  • 1
    Thanks. That worked on my rooted device.
    – Vishal
    Sep 17, 2013 at 18:36
  • 44
    @clu after running adb shell I get following 127:shell@android:/$ However su is not recognized...please help
    – aspiring
    Nov 26, 2013 at 16:01
  • 5
    @aspiring make sure your device is rooted of course (when I run su on my device, I get a SuperSU prompt on the device where I have to press "grant"); Additionally, this may be unrelated, but I also have busy box 1.20.2 installed on my device (for the TotalCommander add-in to function properly), so if your device is rooted and you still can't su, try installing Busy Box maybe? (Otherwise, my device is fresh.) Mar 14, 2014 at 22:29
  • 1
    Above two steps worked. Not it is saying me root@c5302:/ # Then I entered adb root but it said device not found. Aug 28, 2015 at 17:43
  • 1
    @aspiring You need a rooted device and need to install superSU as well.
    – mchid
    May 10, 2016 at 19:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.