简体   繁体   中英

How can i read the .db file for my android app in device

I am writing an android application involving writing database. Is there any method that can view the .db file in device beside rooting my machine??? I have tried using questoid sqlite manager and the data/data/(my application name)/.db cannot be opened. The method seem to be used for emulator and rooted device only.

ps I am using a unrooted device for debugging.

Here is the cap screen for DDMS

DDMS的盖屏

Yes , there are 2 methods from which u can view ur db data :

Go To DDMS -> Data -> Data -> Select ur Package ->Databases -> Pull them Out and view with SQlite Broswer

OR

Install Root Apk in ur bluestack and view in device or emulator itself..

From Command Prompt you can try this

Open cmd
Go into 'Platform tools'
Type 'adb shell'
su
Press 'Allow' on device
chmod 777 /data /data/data /data/data/com.application.package /data/data/com.application.package/*
Open DDMS view in Eclipse and from there open 'FileExplorer' to get your desired file

在此处输入图像描述

In your manifest file, add a property 'debuggable=true' in application tag. Then find your database in your given path.

I assume you mean for debugging?

You could copy the database file to a non-private directory (for example into the one returned by Context.getExternalFilesDir() . Afterwards you can useadb pull to copy it to your development machine.

Install this APK into your emulator and read your DB file and also add,update,delete record of your database

在此处输入图像描述

You can view (visualize) the data in the .db file by using the software called "DB Browser for SQLITE"

  1. get your .db file from the device(smartphone) memory (by accessing the DDMS --> File explore)
  2. download and install sqlitebrowser ( http://sqlitebrowser.org/ )
  3. after installing, open "DB Browser for SQLITE" and go to "open database" to load your .db file
  4. Choose the "Browse data" tab
  5. Finally, select the table you want to visualize to display the data in the database. 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM