通过Eclipse包括与Android应用程序的数据库文件 [英] Include a database file with Android application via Eclipse

查看:182
本文介绍了通过Eclipse包括与Android应用程序的数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Run / Debug的一部分,如何指示Eclipse将文件从我的Android解决方案复制到模拟器?我有一个小数据库,存储在Assets,需要伴随应用程序。到目前为止,我只是简单地使用DDMS复制文件,但更喜欢自动包括。项目属性允许我指定构建的一些方面,例如。构建顺序和应该包括哪些库,但我没有看到任何关于简单地复制文件。

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.

推荐答案

您的res / assets文件夹中的文件不可使用 AssetManager

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?

我使用一个大文件,我存储在res / raw在我的游戏之一,我可以访问这个文件在测试期间使用eclipse没有问题,只是使用正常调用上下文。 getResources()。 openRawResource()

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()

部署数据库与您的应用程序它是一个重复的主题在 android-developers Google群组 这里是一个有关这个问题的几个想法的帖子

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.

祝你好运。

这篇关于通过Eclipse包括与Android应用程序的数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆