java – Is there a way to avoid size limit when using getResources().openRawResource() – Education Career Blog

I am trying to load an XML file from res/raw folder in my Android project when the app first runs. I do this with this line:

InputStream xmlStream = getResources().openRawResource(R.raw.xmlfile);

I then want to use a SAX Parser to get data from the XML file. When doing this LogCat shows the following error:

Data exceeds UNCOMPRESS_DATA_MAX (1290892 vs 1048576)

Is there anyway around this 1MB limit?

After a few Google searches, I found people who have split their files into 1MB chunks, but these weren’t XML files so I am not sure how I would rejoin them before making the InputSource for my SAX Parser.

My file is not created by me, so I can’t really edit it (although I may have to) and my code works if I retrieve it from Internet. Its around 1,300KB in size, so I want to not have to download it each time app run


Is there anyway around this 1MB limit?

Give your file an extension that will not be compressed by aapt during the build process. For example, I think it skips compressing .mp3 files.

Leave a Comment