1、在PC环境下启动一个模拟器(不是手机)

2、查看模拟器 /systen/xbin是否有sqlite3命令

adb shell
cd /system/xbin
ls

3、把模拟器 /system/xbin/sqlite3命令文件从模拟器拷到PC上

adb pull /system/xbin/sqlite3 e:/eclipse

4、关闭模拟器,把Android手机连接到PC

5、获取Android手机 /system 文件夹的读取权限

adb shell # mout -o remout, rw -t yaffs2 /dev/block/mtdblock3 /system //(根据自己的设备网上很多人的设备是这个)

6、把PC上的e:/eclipse/sqlite3文件拷到Android手机的/system/xbin/目录下

adb push e:/sqlite3 /system/xbin
// 若是提示permission denial
adb shell
chmod system/
cd system
chmod xbin

然后执行上面的 push
若是还是不行就直接 到eclipse DDMS filter explore 下面 /system/xbin
把所用的数据直接从电脑上拖到 /system/xbin 下面

7、修改Android真机/system/xbin/sqlite3命令的权限

adb shell
chmod /system/xbin/sqlite3

然后输入sqlite3

进入到sqlite就可以了。

As an alternative (may not be secure or even good idea though) you can always upload the sqlite3 binary to /system/bin this worked for me:

// First lets mount /system/ to allow read/write (rw)
$ adb shell
$ su
# mount -o remount,rw /system // in another terminal change directory (cd) to where sqlite3 is and lets push it
$ ls
sqlite3
$ adb push sqlite3 /sdcard/ // Now back to the other shell lets copy and change permissions of the binary
# cat /sdcard/sqlite3 > /system/bin/sqlite3
# chmod /system/bin/sqlite3 // Now lets mount back /system/ as read only (ro)
# mount -o remount,ro /system // And now we can use sqlite3 from shell:
# sqlite3 /data/data/com.telly/databases/fun.db
SQLite version 3.7.
Enter ".help" for instructions
sqlite> .tables
android_metadata lulz // Note: I'm using the sqlite3 binary that comes with "SuperOneClickv1.6.5-ShortFuse"
// You can always pull sqlite3 binary from emulator:
// Start an emulator and then from a terminal
$ adb pull /system/xbin/sqlite3

Works on rooted Nexus-S running Android ICS 4.0.4 using the sqlite3 binary from SuperOneClick

shortfuse.org/?page_id=2

download.cnet.com/SuperOneClick/3000-2094_4-75447027.html

On the Nexus 4 do the following :

adb shell
$ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# dd if=/sdcard/sqlite3 of=/system/xbin/sqlite3
# chmod /system/xbin/sqlite3
# mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

Notice the folder is /system/xbin and the chmod is 777

This works on my nexus 4 with kitkat , sqlite3 binary got from the emulator /system/xbin folder

To install sqlite3 on NON-ROOTED devices, here is a way that has been proved working on my Galaxy S3, FYR.

$ 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 -- : sqlite3
$ chmod sqlite3 # change mode bits, to be executable $ ./sqlite3 # now it works on your NON-ROOTED device
SQLite version 3.7. -- ::
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

If you are lazy like me you can

download one right here for ICS or before or

for Jelly Bean and later here

From the answer of evelio, I had problem to push the sqlite3 file to /system/bin. So, instead, I have pushed it to the /sdcard.

In this thread I found the right Solution (answer of Kila): How can I install sqlite3 on rooted NexusOne runs Gingerbread

$ adb push sqlite3 /sdcard/

$ adb shell

$ su

# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

# dd if=/sdcard/sqlite3 of=/system/bin/sqlite3

# chmod  /system/bin/sqlite3

# mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

It works on my Samsung Galaxy S II with 2.3.3

Titanium Backup installed, Set the variable
%SQLITE3 to "/data/data/com.keramidas.TitaniumBackup/files/sqlite3".

I actually copied the titanium backup sqlite3 binary to system/xbin and it has been working for me since.

A symlink is an alternative solution, if you want the binary in your PATH (/system/xbin) and your system-rom is nearly full.
For example there is only 200KB free space left in the /system of my Nexus 7 after installing Lollipop + SuperSu + Busybox.

su
mount -o remount,rw /system
ln -s /data/data/com.keramidas.TitaniumBackup/files/sqlite3 /system/xbin/sqlite3
mount -o remount,ro /system

Symlink has only 53 B and the binary has 300 KB.

Use the attached sqlite3...extract & copy it to the /system/xbin folder...give execute permissions [0755] and it should work
http://forum.xda-developers.com/attachment.php?attachmentid=2246063&d=1378751634 : 2012-03-20 (3.7.11)

After copying file, you need to reboot.

Version of SQLite used in Android?

Using the emulators (adb shell sqlite3 --version):

SQLite 3.8.6:

22-5.1-Lollipop

SQLite 3.8.4.3:

21-5.0-Lollipop
20-Android L Developer Preview

SQLite 3.7.11:

19-4.4-KitKat
18-4.3-Jelly Bean
17-4.2-Jelly Bean
16-4.1-Jelly Bean

SQLite 3.7.4:

15-4.0.3-Ice Cream Sandwich
14-4.0-Ice Cream Sandwich
13-3.2-Honeycomb
12-3.1-Honeycomb
11-3.0-Honeycomb

SQLite 3.6.22:

10-2.3.3-Gingerbread
9-2.3.1-Gingerbread
8-2.2-Froyo

SQLite 3.5.9:

7-2.1-Eclair
4-1.6-Donut
3-1.5-Cupcake

Note: Android SDK level links show where the android.database.sqlite package has changed.

Where there is no link (e.g. SDK level 17), indicates no changes to that package.

Note: Here are some anomalies (list by no means exhaustive):

SQLite 3.7.13 (instead of 3.7.11):

LG Optimus L70 MS323 LGMS323|KOT49I.MS32310b (19-4.4-KitKat)
LG Optimus G E975 LG-E975|JZO54K (16-4.1-Jelly Bean)
LG G2 D802 LG-D802|JDQ39B (17-4.2-Jelly Bean)

SQLite 3.7.6.3 (instead of 3.6.22):

LG Optimus Sol E730/myTouch E739/myTouch Q C800 (10-2.3.3-Gingerbread, GRJ22)
LG Optimus Vu F100S/F100L (10-2.3.3-Gingerbread, RK39F)
LG Optimus LTE TAG F120K/F120L (10-2.3.3-Gingerbread, GRK39F)
LG Optimus LTE L-01D (10-2.3.3-Gingerbread, GRJ90)
LG Optimus Net P690b (10-2.3.3-Gingerbread, GINGERBREAD)
LG Prada KU5400 (10-2.3.3-Gingerbread, GWK74)
LG Prada P940 (10-2.3.3-Gingerbread, GWK74)
LG LU6200/SU640 (10-2.3.3-Gingerbread, GRJ90)s

SQLite 3.7.5 (instead of 3.7.4):

Samsung Galaxy Note (15-GT-N7000|IML74K.ZSLPF)
Samsung Galaxy SII (15-SC-02C|IML74K.OMMP4 and GT-I9100|IML74K.DXLP7)
Samsung Galaxy S Duos (15-GT-S7562|IMM76I.S7562XXBMD6)
Samsung Galaxy Tab 7.7 (15-GT-P6810|IMM76D.ZSLP8)

SQLite 3.7.0.1 (instead of 3.6.22):

LG Esteem MS910 (10-2.3.3-Gingerbread, GSE-_v.05)
AndroTab (8-2.2-Froyo, 1.0.7100.0385)
GPLUS MUSN M500 (8-2.2-Froyo, FRG83G)

SQLite 3.6.23.1 (instead of 3.5.9):

Motorola Backflip MB300 (7-2.1-Eclair, ERD79)
Garmin-Asus nüvifone A10/A50/Garminfone (7-2.1-Eclair, ERE27)

Note: adb command to get SQLite version only works on emulators and

on devices with sqlite3 available: http://stackoverflow.com/a/3645800/444761

如何设置Android手机的sqlite3命令环境的更多相关文章

  1. [转]设置Android手机以使用ARM Streamline进行性能分析(一)

    本博客第一次转载的文章,原文访问不到了,这篇是从google cache里挖出来的,为有需要的同学准备.原文地址     Posted by Fang Bao,(鲍方) 4 Comments 11 J ...

  2. [转]设置Android手机以使用ARM Streamline进行性能分析(二)

    原文因为arm社区改版访问不到了,原作者鲍方,原文地址,这篇是从google cache里挖出来的,希望能帮到要对cocos2dx优化的各位   Posted by Fang Bao, Leave C ...

  3. ubuntu下设置Android手机驱动

    如果下面的文章不好使,建议读一这个文章:http://forum.xda-developers.com/xperia-u/general/howto-usb-connection-to-ubuntu- ...

  4. Android 手机 ADB FastBoot 命令基本用法

    adb用法: 准备: 1.在电脑上安装相应的USB驱动,在各分区置顶帖子有下载链接 2.手机进入设置->开发人员选项->勾选USB调试 adb devices 查看是否有设备 adb sh ...

  5. android手机出现sqlite3 not found的解决方法

    解决方法如下: 1.如果/system目录为不可读写的,需要挂载为读写: C:\Users\easteq>adb shell root@android:/ # mount -o remount, ...

  6. Android手机应用程序开发环境配置(Eclipse+Java+ADT)

    参考: Java手机游戏开发实例简明教程 http://dev.10086.cn/blog/?uid-82940-action-viewspace-itemid-1772 Eclipse下载: htt ...

  7. 使用adb命令操控Android手机(adb命令)

    1) 手机连接电脑之前 首先,查看安卓手机是否已经连接上电脑 adb devices 让adb一直查找安卓设备,找到后才停止 adb wait-for-device 2) 手机连接电脑后的操作 2.0 ...

  8. 如何使用 sqlite3 访问 Android 手机的数据库

    如何设置Android手机的sqlite3命令环境 http://www.cnblogs.com/linjiqin/archive/2011/11/28/2266619.html SQLite3 为a ...

  9. 如何在 Android 手机上实现抓包?

    如何在 Android 手机上实现抓包? http://www.zhihu.com/question/20467503 我想知道某个应用究竟在数据提交到哪里,提交了什么.网上的教程太复杂,不想麻烦.有 ...

随机推荐

  1. Hadoop(三):MapReduce程序(python)

    使用python语言进行MapReduce程序开发主要分为两个步骤,一是编写程序,二是用Hadoop Streaming命令提交任务. 还是以词频统计为例 一.程序开发1.Mapper for lin ...

  2. API文档管理平台

    一.应用场景 在公司中,有很多开发,每个人维护的api接口是不一样的.如果有一个统一的api文档管理平台,每个开发,把自己维护的接口录入进去. 之后再开发别的功能时,不需要重复造轮子,直接调用就可以了 ...

  3. MySQL学习笔记:coalesce

    函数:coalesce 作用:返回传入的参数中第一个非NULL的值 ); # ); # 如果传入的参数所有都是NULL,则返回NULL,比如: SELECT COALESCE(NULL, NULL, ...

  4. .net程序员写业务代码需要注意的地方

    代码规范要求1.命名空间规范:dao层的impl实现和接口采用一样的命名空间,到对应文件夹层:IxxDaoContext与其实现类采用顶级命名空间. 2.TableEntity文件夹:所有的实体放到各 ...

  5. HBase(九)HBase表以及Rowkey的设计

    一 命名空间 1 命名空间的结构 1) Table:表,所有的表都是命名空间的成员,即表必属于某个命名空间,如果没有指定, 则在 default 默认的命名空间中. 2) RegionServer g ...

  6. Codeforces Round #207 (Div. 1) D - Bags and Coins 构造 + bitset优化dp + 分段查找优化空间

    D - Bags and Coins 思路:我们可以这样构造,最大的那个肯定是作为以一个树根,所以我们只要找到一个序列a1 + a2 + a3 .... + ak 并且ak为 所有点中最大的那个,那么 ...

  7. hdu 5936 2016ccpc 杭州 - D

    数学题好难啊!!!! 最长长度不超过十位, 折半枚举... 题解 #include<bits/stdc++.h> #define LL long long #define fi first ...

  8. ThinPHP3.2中 addAll()批量插入数据

    thinkphp中model类的addAll()方法可以将数据同时添加到数据库中. 1 2 3 4 5 6 // 批量添加数据 (only MySQL) $user = M('user'); //ar ...

  9. vue 父子间组件传值

    1.父组件向子组件传值: 实例截图: 实例代码: /*子组件代码*/ //child.vue <template> <div style="border: 1px soli ...

  10. 关于table边框,设置了border-collapse:collapse之后,设置border-radius没效果

    做项目遇到边框需要设置圆角,然后发现在设置了border-collapse:collapse之后,border-radius:10px不起作用了,发现这个是css本身的问题,两者不能混在一起使用. 代 ...