1

I'm developing a content provider which stores its data in an SQLite database. During development, I need to change the schema, or delete the database entirely and have it rebuilt (I'm not upgrading the database at this stage of development).

I found the database file, stored at /data/data//databases/app_db . When I pull it to my desktop machine, I can use SqliteSpy to see its content and all is well. However, when I delete it, it doesn't always get really deleted. Although I can't see the file in DDMS or ADB, my application still sees it.

I tried to make sure my application and service aren't up when I delete the file, but it doesn't seem to help. In about half the times I delete the file, I need to restart the emulator for it to have effect.

What could be preventing the file from being really deleted?

Itay.

zmbq
  • 38,013
  • 14
  • 101
  • 171

1 Answers1

2

I've seen this issue too when was writing unit tests for my ContentProviders. You need to make sure you've killed the process that hosts ContentProvider that uses that specific database file. And only than delete it.

inazaruk
  • 74,247
  • 24
  • 188
  • 156
  • I tried it a couple of more times, this time making sure the application is down *before* deleting the file (yesterday I think I deleted the file and then shut the application done). It seems to work now. Thanks! – zmbq Nov 21 '11 at 09:58