[Android SDK中]不能从资产中复制外部数据库(13MB)资产、数据库、SDK、Android

2023-09-13 01:42:59 作者:无声换场

我需要的意大利语单词的游戏我正在开发一个名单,但我不能真正使之从资产复制我的数据库。我试图quitea很多的解决方案,我发现在网站上,如:

I need a list of italian words for a game I'm developing but I can't actually make it copy my database from assets. I tried quitea lot of solutions I found on the website, such as:

在Android应用程序中使用自己的SQLite数据库 how复制占地从资产的文件夹的内存,以我的应用程序大的数据库? Load文件大于1M的资产文件夹 Using your own SQLite database in Android applications how to copy large database which occupies much memory from assets folder to my application? Load files bigger than 1M from assets folder

但我没有运气,它不断给我这个错误就行

But I had no luck, it keeps on giving me this error on the line

os.write(buffer, 0, len);

但我不明白为什么。这里的功能的code 和的常量中我使用。 一个奇怪的变薄的是,我的数据库停止复制11.45MB后,仅1 MB偏离目标。

but I can't understand why. Here's the function's code and the constants I'm using. A strange thins is that my database stops copying after 11.45MB, just 1 MB away from the goal.

有人可以帮助我解决这个问题?非常感谢:)

Can someone help me solve this? Many thanks :)

推荐答案

使用 SQLiteAssetHelper ,它具有包的数据库,与最的应用程序逻辑的调试版本,所以你不需要惹任何这样吧。

Use SQLiteAssetHelper, which has a debugged version of the package-the-database-with-the-app logic, so you do not need to mess with any of this yourself.

 
精彩推荐