歡迎和大家交流技術相關問題:
郵箱: jiangxinnju@163.com
博客園地址: http://www.cnblogs.com/jiangxinnju
GitHub地址: https://github.com/jiangxincode
知乎地址: https://www.zhihu.com/people/jiangxinnju
Android版本: 4.4.2
PS C:\Users\jiang> adb shell
shell@hwH60:/ $ su - root
# 此時輸入sqlite3 發現命令無法使用
root@hwH60:/ # sqlite3
tmp-mksh: sqlite3: not found
# find一下相關文件,確定到底需要安裝哪些內容,如果已經找到則不需要安裝對應文件
root@hwH60:/ # find . -name "sqlite3"
root@hwH60:/ # find . -name "libsqlite.so"
root@hwH60:/ # find . -name "libsqlite_jni.so"
root@hwH60:/ # exit
shell@hwH60:/ $ exit
# 從https://files.cnblogs.com/files/jiangxinnju/sqlite3.zip處下載文件並解壓。
# 將相關文件放到內置存儲卡中,為什么不直接放到/system/xbin/和/system/lib/可以參考<http://www.cnblogs.com/jiangxinnju/p/8186390.html>
PS D:\> adb push sqlite3 /storage/emulated/0/
PS D:\> adb push libsqlite.so /storage/emulated/0/
PS D:\> adb push libsqlite_jni.so /storage/emulated/0/
PS D:\> adb shell
shell@hwH60:/ $ su - root
# 為什么需要重新掛載/system分區可以參考<http://www.cnblogs.com/jiangxinnju/p/8186390.html>
root@hwH60:/ # mount -o remount rw /system
# 將需要的文件從內置存儲卡中轉移到目標目錄
root@hwH60:/ # cp /storage/emulated/0/sqlite3 /system/xbin/ <
root@hwH60:/ # cp /storage/emulated/0/libsqlite.so /system/lib/
root@hwH60:/ # cp /storage/emulated/0/libsqlite_jni.so /system/lib/
# 修改對應文件的權限
root@hwH60:/ # chmod 4755 /system/xbin/sqlite3
root@hwH60:/ # chmod 0644 /system/lib/libsqlite.so
root@hwH60:/ # chmod 0644 /system/lib/libsqlite_jni.so
# 執行sqlite3命令,發現已經可以使用
root@hwH60:/ # sqlite3
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .exit
root@hwH60:/ # exit
# 刪除內置存儲卡中的文件
shell@hwH60:/ $ rm -rf /storage/emulated/0/sqlite3
shell@hwH60:/ $ rm -rf /storage/emulated/0/libsqlite.so
shell@hwH60:/ $ rm -rf /storage/emulated/0/libsqlite_jni.so