Libgdx - asset files double in .apk

This is my first time trying to pack my libgdx project into an .apk file, and I am surprised that the file is 2 times larger than the total size of the asset files. the resource folder should be 4 MB, but the .apk file has become 8 MB. I tried to check the source of the problem by extracting the .apk file. At first I thought it was a library file that was causing the problem, but then I checked that it takes up only 1 MB of memory. Then I found out that the folder with images and music in the resource folder is copied from the outside and is twice as large.

here is my android directory structure in eclipse project

-src -gen -asset ->image (30kB) ->musics (3MB) ->sfx (100kB) -bin -libs -res 

and here is the directory inside the .apk file

 -assets ->image (30kB) ->musics (3MB) ->sfx (100kB) -com -images (30kB) -lib -META-INF -musics (3MB) -res -sfx (100kB) 

Does anyone have such a problem? any decision on this? thanks

+4
source share
1 answer

Your assets are extracted twice: once from the $ ANDROID_PROJECT / assets directory and once from the classpath of your desktop.

You have 3 projects, a common code, a desktop, and Android. The joint code project contains the actual application code, the desktop project contains a link to the source folder for the android / assets folder, as well as the starter class for desktop computers, the android project contains the assets and the android starter class.

You can also try not to export the source assets folder from your main project, but a little more.

+5
source

Source: https://habr.com/ru/post/1388877/


All Articles