Unable to use adb pull to retrieve application database file using adb pull

Hi,

I am trying to develop an application for Zebra TC56 Android devices. My app uses a couchbase on device database. Now for development purposes I need to be able to pull the database file off the device to my computer so that I can inspect the data in it.

My problem is using adb pull I get Permission denied errors.

What I have tried till now

adb shell run-as <application_package> pull /data/data/<application_package>/files/myDb.cblite2

This ends up giving nothing or permission denied error.

Is there a specific way to access application files for development purposes on Zebra devices without rooting into the device ?

Dmitry Prokhorov
Hello Sumeet,Could you please

Hello Sumeet,

Could you please to try a following command on your device:

adb exec-out run-as <application_package> cat files/myDb.cblite2 > myDb.cblite2

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sumeet Singh
Well that did work out (to

Well that did work out (to some extent). But it seems like the myDb.cblite2 is not a file but a directory which further has Database files inside of it.

I tried copying each individual file (using the suggested way) but it seems like the encoding of the files gets messed up and makes them useless.

Any way we can copy the myDb.cblite2 as a directory from the device to the local machine?

- Thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Sumeet,Sure, you can

Hello Sumeet,

Sure, you can check first is it a directory or not:

adb exec-out run-as <application_package> ls -l files/

In case it is a directory, you can copy it in a following way:

adb exec-out run-as <application_package> tar c files/myDb.cblite2 > myDb.cblite2.tar

tar xvf myDb.cblite2.tar

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Bob LobLob
Yeah, this doesn't work for

Yeah, this doesn't work for me. It's highly disappointing that you feel that you need to prevent rooting these devices. If it were up to me I'd be trying to flash your ROMs and get the devices to work on something else. There's is no reason that a developer shouldn't be able to root these devices. While there are plenty of dumb developers, there's no indication that, in general, a team would issue rooted devices into production.

With that said, do you mind helping me get the darn sql database off the device?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sumeet Singh
What are you stuck at ? Does

What are you stuck at ? Does the above commands not execute for you or there are errors ?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bob LobLob
I can run the ls, but tarring

I can run the ls, but tarring up the database gives me access is denied. If I try writing it ">" to /sdcard/DCIM/DatabaseName.db3 it returns the system cannot find the path specified, which is at least one directory I know I can write to as the application/APK user.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Dmitry Prokhorov
Hello Bob,Would you please to

Hello Bob,

Would you please to share a bit more details on your case:

1) What is a mobile device model?

2) What version of Android you have installed on device?

3) Full text of command you are using.

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bob LobLob
I manually copied the

I manually copied the database files as the application user to the sdcard/DCIM folder and was able to do a pull to my local with the standard/default shell. So, I now have the DB, thanks.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments