问题
I am a student and I want to learn about using sqlite3 on android. My friend tried to run the android emulator and start typing commands adb -e shell
, su
, navigated through the emulator storage, then run sqlite3 mydb.db
. Everything went fine. But whenever we tried running adb with the use of an external physical android device, running sqlite mydb.db
is a problem. ADB cannot somewhat find the sqlite executable. I already rooted my device and granted permission the adb but still it doesn't seem to find the sqlite executable.
I did some research. I found out in another post that some of android devices do not have sqlite built in. So I tried researching for any possible ways to install sqlite3 on android system. I found this. One of the answers suggested this. I already tried but The installer doesn't work for me. In the same question, the selected answer is to pull sqlite from an emulator (that supports one) and push it to my device.
The problem with this method is we have limited amount of resources. The laptop I'm working on has only 1 GHz CPU and 3 GB RAM. Android Studio won't even let me run an emulator because of the speed of my CPU. Copying from a faster and better laptop that can run emulator (that can emulate device with sqlite3) is only my last and very final option. Is there any other way?
回答1:
For future students I'll answer this question
Download here compiled sqlite3 for android
push to the device via adb push sqlite3 /data/local/tmp
give permission to execute via adb shell && cd /data/local/tmp && chmod +X sqlite3
and run
/data/local/tmp/sqlite3 /data/data/com.app/databases/some_database.db "SELECT name FROM sqlite_master WHERE type='table'"
来源:https://stackoverflow.com/questions/42025809/installing-sqlite3-on-an-external-device-without-emulator