1

how to copy my contacts from my sony ericsson wt19i android 2.3 to sdcard? I tried to do this by adb, but does not work. I do it like this: adb devices

adb shell

su

mount -o rw,remount rootfs /

chmod 777 /mnt/sdcard

adb pull /data/data/com.android.providers.contacts/databases/contacts2.db /mnt/sdcard/tmp/contacts2.db

an error appears:

adb: not found

what should I do?

  • 1
    Can you not export them from Contacts app? – Firelord Dec 26 '15 at 14:24
0

Thanks to @Firelord for generously helping me out when I got out of my depth. The problem description and notes about the solutions have been made using his comments as reference.

Problem:

That is because after you've issued adb shell, you're in Android's system shell and cannot use adb pull any longer, as the client ADB binary you invoked exists on your development PC, not on the connected device itself. The device acts as a server with the development PC as the client. The client issues the commands and the server responds to them. The server itself cannot issue the command.

The ADB on-device itself can also act as the client, with 2 caveats:

  1. ADB from device to same device needs ADB to be running in wireless and loopback mode.
  2. The other device, supposedly the "server", must initially be connected via OTG to the ADB client (later client & server) device so that ADB can be restarted there in wireless mode.

TL;DR

If you're running adb from the platform-tools directory of the Android SDK install, try issuing ./adb pull instead of adb pull in case you are on Linux, and, I suspect, similar with Windows. ADB is probably not in your PATH variable. The terminal remembers the folder history 1 level down, and the local folder by default is not included in the PATH variable.

SOURCE: This question on StackOverflow.

Resolution:

What you should do after the chmod command is enter exit, followed by adb pull.... The exit command should drop you out of the system shell back to whatever terminal/prompt you were using adb in on your PC, from where you can safely use adb pull.

Alternative Resolution:

You could also use cp instead of adb pull after chmod to copy the database file. They have the same usage pattern, and cp is definitely available in the shell session.

Notes:

  1. I have a niggling issue with the way in which you use adb pull to copy files from your /data/data to your SD card, which could easily be accomplished with a root explorer or cp in a shell session.

  2. Ensure that you have issued adb root prior to this entire set of commands under Resolution: so the adb daemon runs as root and can access /data and its subdirectories.

PS:

From @Firelord's comment, adb root will only work if you have set the ro.secure property in your build.prop to 0 instead of 1, where 1 is usually the default with the exception of some debug-enabled custom ROMs. In that case, take the cp alternative.

  1. I have personally faced this issue and avoided mixing up ADB and shell sessions from then on.
  • adb help is not an exception. You can use all the adb commands from the device itself. It works this way: normally, the Android device acts as a server and PC with adb as the client. The client issues directions using commands and server responds to them. ADB in device can also act as a client but with certain tweaks: 1) ADB should be running in wireless and loopback mode if you want to run adb commands on the same device from the same device, 2) the other device, supposedly a server, would need to be connected using OTG briefly so that adb daemon can be restarted there in wireless mode. – Firelord Dec 29 '15 at 5:09
  • adb root would work if ro.secure is set to 0 which by default is often not the case. If the prop is set to 1, user would encounter the error. Consider mentioning a workaround for the problem if you intend to keep that adb root point in the answer. – Firelord Dec 29 '15 at 5:21
  • @Firelord, check out the edit and the TL;DR – Tamoghna Chowdhury Dec 29 '15 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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