Android Sqlite3 program does not exist the workaround

Source: Internet
Author: User
Tags root access

In Android development, when you use the command line to manipulate database SQLite, you sometimes encounter problems with sqlite3 not found. This is because your phone does not have the SQLITE3 program installed. The solution is as follows (two ways to combine to explain more clearly!!!) ):

Method 1:

Sqlite3 not found solution (RPM)

In the development of Android, I was small white, started not long. The recent use of SQLite local cache data, I want to like MySQL through the command line to view the established tables and data in the table, so with the ADB shell entered, typed Sqlite3, prompting Sqlite3:not found. Online Search, the article is a lot of online, but if the direct copy of their orders, found still error, so he studied the following, summarized as follows, hope to meet the same problem friends less detours:

1. Need to get root access to the phone, the method is many, I use 3,601 key root, and sometimes with a key Baidu root

2. From other mobile phone copy sqlite3 file to PC, I was copied from the simulator, for the convenience of everyone, accessories have, you can directly download ha

3. Enter the phone to create a temporary directory

Start---cmd---adb shell---mkdir/mnt/sdcard/tmp, and then exit to CMD

ADB push d:/temp/sqlite3/mnt/sdcard/tmp

4. copy file to/system/xbin

ADB shell

SU (This step report permission denied the word is root did not succeed, re-root it)

Cp/mnt/sdcard/tmp/sqlite3/system/xbin/sqlite3 (Note: This step may be reported in two types of errors, the first: CP not found, change the command to Cat/mnt/sdcard/tmp/sqlite3 >/ System/xbin/sqlite3, the second type: Read-only file system, stating that/system is read-only and needs to be re-mount, read-write, and then continue copying)

The re-mount method is as follows:

Mount (from the Mount data listed on the screen, locate the/system mount information, separated by spaces, the first column represents the device name, the second column represents the directory, the third column represents the file system, and the fourth column represents the permission. Other tutorials on the Web The command is listed directly in this step, because the device name and file system are not the same, so the execution is unsuccessful.

The Mount command is: Mount-o remount,rw-t third column information The first column of information/system

For example, pay attention to the place where the circle is red:



After the mount succeeds, the file copy procedure above is executed, and then it can be copied to the/system/xbin directory.

Need to change the permissions of the file, command: chmod 4755/system/xbin/sqlite3

Last run, Sqlite3, find it.

Method 2:

Reason: Sqlite3 is an executable program, under system/xbin/, some ROM does not carry this thing, resulting in no such tool.

Workaround: Copy a sqlite3 in.

Steps:

1) Make/system folder readable and writable

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

2) Open another simulator with sqlite3 (/SYSTEM/XBIN/SQLITE3) or a mobile phone, export the sqlite3 and import it into the/system/xbin without the sqlite3 machine. (You can do this with DDMS)

$ adb push sqlite3 /system/xbin

3) Modify the permissions of the Sqlite3

# chmod 4755 /system/xbin/sqlite3

4) Welcome/system as read-only file

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

5) Now you can use the Sqlite3 command.

# sqlite3 /data/data/com.mobisync.android/databases/sync.db SQLite version 3.6.22Enter ".help" for instructions sqlite> .tables android_metadata  file              sync_status

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.