Stack Overflow archive
3 scoreaccepted

android access log file from pc

score
3
question views
421
license
CC BY-SA 3.0

Files in /data are not readable by the shell user. You need to use the run-as command, which will work as long as the debug build is installed.


You can check if the file exists:

bash
adb shell run-as com.tayek.tablet.gui.android.cb7 ls files

To copy the file to your PC, you will need to copy the log file to your SD card and then use adb pull to retrieve the file. On Android 5.0+ you could simply do:

bash
adb shell exec-out run-as package.name cat files/tablet.log > tablet.log

This should work on previous (and current) Android versions:

bash
> adb shell
$ run-as package.name
$ cp files/tablet.log $EXTERNAL_STORAGE/tablet.log
$ exit
> adb pull /sdcard/tablet.log

Obviously, replace package.name with your package name (com.tayek.tablet.gui.android.cb7).


See: android adb, retrieve database using run-as

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.