简体   繁体   English

从assets文件夹中删除数据库文件

[英]Delete database file from assets folder

I want to delete a file in assets folder in run-time. 我想在运行时删除assets文件夹中的文件。 I have a database file in assets folder that copies to data folder at run-time but after installing my app the size of app become twice as large (assets + data folder)! 我在资源文件夹中有一个数据库文件,在运行时复制到数据文件夹但在安装我的应用程序后,应用程序的大小变为两倍大(资产+数据文件夹)!

How I can delete database file from assets folder to avoid this? 如何从assets文件夹中删除数据库文件以避免这种情况?

You can't delete a file at runtime that was delivered with your App. 您无法在运行时随应用程序一起删除文件。

See this discussion about it: 看到关于它的讨论:

How to remove a file in assets at run time? 如何在运行时删除资产中的文件?

The whole content of your APK is read only and can not be modified 您APK的全部内容是只读的,无法修改

除了上面的答案,你可以做的一件事就是在manifest ...中的preferExternalStorage将会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM