Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6898893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:21:11+00:00 2026-05-27T07:21:11+00:00

I am presently working on an WiFi application for Android. I am having trouble

  • 0

I am presently working on an WiFi application for Android. I am having trouble trying to access the database on the device. Debugging in the emulator doesn’t work for me, because there is no WiFi support in the emulator. I tried pulling the database file out of the device by using

adb pull data/data/package-name/databases/database-name

But I get the error “Permission denied.”.
In this answer Android: Where are database files stored?, Commonsware has suggested to pull database file by running in debug mode. But it doesn’t work too. Any help on how to debug the database without rooting the device would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:21:12+00:00Added an answer on May 27, 2026 at 7:21 am

    I’ll repeat myself from another answer:

    Starting from API level 8 (Android 2.2), if you build the application as debuggable, you can use the shell run-as command to run a command or executable as a specific user/application or just switch to the UID of your application so you can access its data directory.

    Copy files to external storage on the device

    So if you wish to pull your application database from the device you can launch a debug build of the application from Android Studio, connect with adb shell and run the following command:

    run-as com.your.package sh -c "cat ~/databases/db-file.db" > /sdcard/db-file.db
    

    or you can use a shorter version which uses relative paths and by skipping the reference to the home directory ~ can omit the sh -c part too:

    run-as com.your.package cat databases/db-file.db > /sdcard/db-file.db
    

    This will copy your db-file.db to the root of your SD card / external storage. Now you can easily get it from there by using file manager, adb pull or whatever else you like. Note that with this approach, there is NO need for your app to have WRITE_EXTERNAL_STORAGE permission, as the copying is done by the shell user who can always write to the external storage.

    Copy files directly to the computer

    You can also copy a database directly to your computer with the following command:

    adb shell 'run-as com.your.package cat databases/db-file.db' > db-file.db
    

    The adb shell command above will not work correctly on Windows host because of the CR/LF symbols conversion, unless you run it from a bash shell or use the undocumented adb exec-out command instead (some comments mention they still cannot get it to work correctly on a Windows machine, so your mileage may vary):

    adb exec-out 'run-as com.your.package cat databases/db-file.db' > db-file.db
    

    Write files back to the device

    If you modified the file on your computer and wish to write the modifications back to the device use the following command:

    adb exec-in 'run-as com.your.package tee databases/db-file.db' < db-file.db
    

    or if you prefer an adb shell version over undocumented exec-in, use the following (but read the concern about the Windows CR/LF conversion above):

    adb shell 'run-as com.your.package tee databases/db-file.db' < db-file.db >/dev/null
    
    Status update

    All the commands above are still working as of July, 2023

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Presently I'm working on a Windows Phone application that will work in both online
I am presently working on converting a 32-bit application into a 64-bit application in
Presently I am working on an application which sends and receives file from remote
I am working on an Android application that is required to connect to a
I'm presently working on a side-by-side application (C#, WinForms) that injects messages into an
I am presently working on a application in which I have a display a
presently iam trying to work with the youtube data api,on searching in net i
Folks, I have android application that presently has 1 warning, in line 80 of
I am a RoR developer, but I am presently working with CakePHP for a
We are presently working for a client who is new to working with distributed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.