2
\$\begingroup\$

I'm developing a game using libgdx targetting Java desktop and Android. For the assets I have a "data" folder inside the "assets" folder in the Android project. Then, I link it from the desktop project.

My problem comes when I export, my .apk contains:

assets
com
lib
data
META-INF
res
AndroidManifest.xml
resources.arsc
classes.dex

This means my data files are duplicated in "assets/data" and "data" being the first one the only relevant one. This increases my APK size from 5 to 10MB which is kind of annoying. In my file system I only have the "assets/data" folder, no trace of the intruder there.

Does someone have any ideas why is this happening? How can I solve it?

PS: I've tried deleting the intruder manually opening the apk with 7zip but that destroys the checksum and prevents updates to be properly installed (needs complete reinstall).

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Finally I found the source of the problem. The Android project was linking against the desktop one to fetch the code and the libgdx libraries. I guess the APK exported saw that and simply copied the whole thing. This includes the link to the data folder in the desktop project, therefore the undesired duplicity.

Solution:

Just create a different project layout:

  • mygame: shared code and base libs.
  • mygame-desktop: desktop started, linked assets, desktop specific libs.
  • mygame-android: Android Activity, original assets, Android specific libs.
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .