I have an issue with my Ubuntu installation of genymotion. Mainly I am unable to debug my database since both through DBMS in eclipse and adb in shell I can not view content of /data/ folder. There are no files shown.
I log through adb by cd to /sdk/platform-tools and typing ./adb shell su . I see that tab is not working, so I blindly type the path. Anyways I am not able to pull db, maybe I'm doing something wrong with commands.
Through DBMS i try to connect but data folder does not display content.
On Emulator everything works smoothly, but emulator is slow and I would rather use genymotion.
Any suggestions how to deal with this problem?
I don't have the problem you are talking about, the default shell user on Genymotion is root, so it should not happen. Despite everything, you can use run-as
command to access your data directly.
To make it short. Your app's data folder is protected by your app's user rights.
The default shell user don't have right access to the app's folder. You can change the user that the shell is using thanks to the run-as
command.
adb shell
run-as your.package.name
This command will change the shell user to the user of your app. So you will have the right to read and write on the app's data. You will also be redirected to your app's data folder: /data/data/you.package.name
When it is done you can browse your files easily.
Notice: Your app has to be built as debug to be able to use this command. It is supposed to be displayed on the device processes list on DDMS.
Run emulator on your local computer, then
localuser:~ localhost$ adb shell
shell@android:/ $ su
shell@android:/ # cp /data/data/your.package.name/databases/your_database.db /mnt/shell/emulated/0/Download/your_database.db
shell@android:/ # exit
shell@android:/ $ exit
localuser:~ localhost$ adb pull /mnt/shell/emulated/0/Download/your_database.db ~/your_database.db
What it does is:
1. Connects to the emulator
2. Requests superuser permissions
3. Copies the file that is only available to superuser to a public directory (Downloads in this case)
4. Pulls the file from public folder (Downloads) to your local machine home directory; you can also perform this step from eclipse gui.
You've to set permissions to that folder / file, then you can pull easily:
adb shell "run-as package.name chmod 666 /data/data/package.name/databases/file"
adb pull /data/data/package.name/databases/file .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With