我得到这个错误:数据超出UNCOM preSS_DATA_MAX在Android 2.2,但不能在2.3能在、但不、错误、数据

2023-09-12 03:37:33 作者:肤浅~~

我只在Android 2.2,但不能在2.3版本得到一个错误。

I am getting an error only on the version android 2.2 but not on 2.3.

错误:

 04-26 13:41:34.862: ERROR/Database(3701):  sqlite3_open_v2("/data/data/com.TravelPharm/databases/medicaments.sqlite", &handle, 1, NULL) failed
 04-26 13:41:34.942: DEBUG/dalvikvm(417): GC_EXPLICIT freed 82 objects / 4000 bytes in 1617ms
 04-26 13:41:35.062: DEBUG/asset(3701): Data exceeds UNCOMPRESS_DATA_MAX (17304576 vs 1048576)
 04-26 13:41:35.062: DEBUG/AndroidRuntime(3701): Shutting down VM
 04-26 13:41:35.072: WARN/dalvikvm(3701): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701): FATAL EXCEPTION: main
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701): java.lang.Error: Error copying database
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at com.TravelPharm.DBHelper.createDataBase(DBHelper.java:395)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at com.TravelPharm.TravelPharm.SumofDetails(TravelPharm.java:290)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at com.TravelPharm.TravelPharm.onCreate(TravelPharm.java:64)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.os.Handler.dispatchMessage(Handler.java:99)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.os.Looper.loop(Looper.java:123)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at android.app.ActivityThread.main(ActivityThread.java:4627)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at java.lang.reflect.Method.invokeNative(Native Method)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at java.lang.reflect.Method.invoke(Method.java:521)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 04-26 13:41:35.103: ERROR/AndroidRuntime(3701):     at dalvik.system.NativeStart.main(Native Method)

据我所知,是因为我的数据库是太大UNCOM preSS_DATA_MAX那么,如何解决这个问题?

i understand that is because my database is too big "UNCOMPRESS_DATA_MAX" so how can i solve the problem??

我会AP preciate任何帮助,

I will appreciate any help ,

感谢您!

推荐答案

我也有一个类似的问题,一番搜索之后,我发现这个页面回答我的问题。

I too have a similar problem and after much searching, I found this page to answer my question.

https://m.xsw88.com/allimgs/daicuo/20230912/5224.png.jpg)或2)关闭COM pression数据库的文件扩展名(看到如何做到这一点的博客文章)。 2号可以但如果你使用的是Eclipse所以笔者建议采用第一种选择是困难的。

In summary, Android compresses any asset file except the ones that are list on the page, since they are already compressed. This compressing is generally a good thing, but it comes back to haunt programmers when a file is too big. The two options that the author suggests are to 1)rename the database file to be one the doesn't get compressed (such as .jpg) or 2) turn off compression for the database's file extension (see the blog post on how to do that). Number 2 can be difficult though if you are using Eclipse so the author recommends using the first option.

这整个问题是在安卓2.3.3这就是为什么你没有纠错的出现:)

This whole problem was corrected in Android 2.3.3 which is why you don't have the error appear :)

编辑:本网站说明它真的只是: https://web.archive.org/web/20120423232710/http://www.nutprof.com/2010/12/data-exceeds-uncom$p$pssdatamax.html

This site explains it really simply: https://web.archive.org/web/20120423232710/http://www.nutprof.com/2010/12/data-exceeds-uncompressdatamax.html

编辑2:回首这个答案,我意识到,这取决于你的文件的大小,也许你可以考虑从Web服务器下载文件,然后将其复制到任何地方,你需要它去。以我为例,我是复制SQLLite数据库到应用程序的私有存储,但由于APK签名,我无法摆脱旧的数据库从我的资产产生。所以现在,而不是所有的时髦命名的东西,我只是去,把它从互联网上下载它在第一次运行,并把它放在私人空间。这样,应用程序不会在第一次运行时的两倍大小。

EDIT 2: Looking back on this answer, I realize that depending on the size of your file, perhaps you could consider downloading the file from a web server and then copying it to wherever you need it to go. In my case, I was copying a SQLLite DB to the app private storage, but since the APK is signed, I couldn't get rid of the old database from my assests. So now instead of all that funky naming stuff, I just went and had it download it from the internet on the first run and put it in the private space. That way the application doesn't double its size on first run.