How to find and clear the SQLite db file in Android (emulator)

I’ve just got my first SQLite database up and running but to reproduce it I wanted a quick way to clear the db file (so I can call my openOrCreateDatabase method again)

First question: I see all over the web /data/data/PKG/databases/ but where exactly is this stored on a windows machine? It doesn’t appear to be in my local project folder because when I do a simple git status, no *.db file is listed after the create is successful.

  • Mobile Development barrier to entry
  • Using cookies with Android volley library
  • getOnClickListener() in Android views
  • Android- Thread.join() causes Application to hang
  • Is it possible to make the Android options menu background non-translucent?
  • Creating project in Android 5.0 Lollipop using Eclipse Juno
  • Also if I wanted to clear this is it a simple delete and the emulator will know to re create this? If not how can I clear it from the emulator? (thinking iPhone here where you had to delete and re-push the app to the simulator to clear this out and have the db re-created)

    Related posts:

    Programmatically getting the MAC of an Android device
    Repeat AnimatorSet
    Making a Snackbar Without a View?
    Force an android phone to sleep, in order to test?
    Is possible to use an Android Animator to animate a DialogFragment entry?
    How to reduce and compress an apk file in android
  • Accessing the Android media stream for audio visualization
  • Android Animation - Flip
  • Android: set list view item as “selected” (highlighted)
  • How To Find Android Google Play Services Version
  • Using Espresso to click view inside RecyclerView item
  • How can I use multiple -S values with aapt without using <add-resource>?
  • 5 Solutions collect form web for “How to find and clear the SQLite db file in Android (emulator)”

    It’s stored inside the emulator, not on your machine (at least, not in a place that is easily accessible). Just remove it using adb:

    C:\> adb -e shell rm /data/data/com.example.package/databases/*.db
    

    You can also choose the “Wipe user data” option when launching the emulator AVD, or you can uninstall the application to wipe all data for just that one app:

    C:\> adb -e uninstall com.example.package
    

    Finally, you can also just clear user data for a given application without uninstalling it, by going to Settings > Applications > Manage Applications… Select your application, then click the “Clear Data” button.

    1. Open Simulator
    2. Click MENU
    3. Click Manage Apps
    4. Locate your app
    5. Click Clear data or Uninstall

    1)Its actually stored in the emulator, If you are using Eclipse then You just go to DDMS and find your database file in the data packages and then in the left there is an option to pull the file out and you can view it. you can use wipe user data on emulator load to clear all data.Or you may uninstall the application by using:

    C:\> adb -e uninstall com.example.package
    

    or, if your application is on a physical phone, use:

    C:\> adb -d uninstall com.example.package
    

    You can run the command:

    adb -s emulator-5554 shell (or whatever port you use)
    cd /data/data/<packagename>/databases/
    

    By typing ls, you will see the databases created and you can remove the one you want with rm

    rm myapp.db
    

    Thanks
    Deepak

    To clear the Database file from Emulator:

    Go to DDMS, then go to file explorer then open data -> data -> urPackage-> urDatabase.

    Here you have your database, and you can delete it by:
    (selecting)Click the database that you want to delete and click minus “-” sign from top right.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.