Some files removed from release version of apk.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By supper_raptor

i have some text (.txt) files present in res:// of my project and they are accessible in debug version of apk but they are not accessible in release version of apk.
How to fix this ?

:bust_in_silhouette: Reply From: Mxt08

I don’t know exactly what your project is like but i think it might help you to relocate the files in “.txt” format inside the code and you probably wouldn’t make it not accessible for the apk file, as by default the code compiles it in “.gdc” and also in “.gd.remap” (if you use GDScript, of course).
I don’t know the cause of this problem, but I hope this advice helps you.
Mxt08 :slight_smile:

i also don’t know what their project is like, but often text files are used for things like credits, story blurbs, etc, which should be loaded by both the game and shown on a website etc, so often it makes sense to only keep one copy of that around, and editing larger texts inside a gdscript can be pretty messy.

for example i have a CREDITS.txt and LEGAL.txt file inside my latest project which can (in theory) be read both on the project’s gitlab page (which is set to private, so in practice it probably wont) and by my code to display the credits (which is where players will see it). just easier to type stuff like that into a text file (technically markdown, even made a rudimentary markdown-to-bbcode parser to render that to a RichTextLabel :P) than just vomiting it right between your code :stuck_out_tongue: separation of data and code being a thing and all that.

plus unless you encrypt your package, long texts inside .gdc files can still be perfectly read out using a tool looking for ascii sequences such as strings. and if you encrypt it it should also encrypt the .txt file packed inside it so that should be fine.

nonchip | 2020-04-24 15:28

:bust_in_silhouette: Reply From: nonchip

.txt by default is not a “resource format”. so you need to add it to your “non resource files to export”.

open your Project->Export settings, select your preset, go to the Resources tab, then in “Filters to export non-resource files/folders” add *.txt. rinse and repeat for all your export presets.

the reason it works in the debug version, is either because the debug version tries to include everything just to be safe, or uses the remote file system API to talk to your editor to access those files from your computer.