Skip to content

Instantly share code, notes, and snippets.

@alxsimo
Created January 24, 2015 20:51
Show Gist options
  • Save alxsimo/295e8dd4dbc44cf69b66 to your computer and use it in GitHub Desktop.
Save alxsimo/295e8dd4dbc44cf69b66 to your computer and use it in GitHub Desktop.
[Android] SQLite on non rooted devices
$ adb -e pull /system/xbin/sqlite3 # get sqlite3 binary from emulator with the same CPU arch.
$ adb -d push sqlite3 /mnt/sdcard # push it
$ adb -d shell
$ run-as <PACKAGE_NAME> # run as your app, which should be debuggable.
$ cd databases; pwd
/data/data/<PACKAGE_NAME>/databases
$ cat /mnt/sdcard/sqlite3 > sqlite3 # copy it to internal storage directory
$ ls -l sqlite3
-rw-rw-rw- u0_a138 u0_a138 36860 2014-03-26 06:37 sqlite3
$ chmod 777 sqlite3 # change mode bits, to be executable
$ ./sqlite3 # now it works on your NON-ROOTED device
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment