Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a database file with Android application via Eclipse

How can I instruct Eclipse to copy a file from my Android solution to an emulator, as part of Run/Debug? I have a small database, stored in Assets, that needs to accompany the application. Thus far I have simply copied the file myself using DDMS but would prefer to have it automatically included. The project properties allow me to specify some aspects of the build, e.g. the build order and which libraries should be included, but I don't see anything about simply copying a file.

like image 703
Justin R. Avatar asked Jun 13 '09 22:06

Justin R.


1 Answers

Is the file in your "res/assets" folder not available using the AssetManager class during testing versus during testing or when installed via a signed apk?

I use a large file that I store in "res/raw" in one of my games, I am able to access this file during testing with eclipse without a problem just using the normal calls to context.getResources().openRawResource()

Deploying databases with your application it a reoccurring topic over in the android-developers Google group here is a post with a few thoughts on the matter.

Good luck.

like image 175
snctln Avatar answered Nov 02 '22 11:11

snctln