Problem
I am developing a game using libGDX with a project structure similar to:
Root project 'gdx-play'
+--- Project ':android'
+--- Project ':core'
\--- Project ':desktop'
Subprojects android
and desktop
depend on core
.
I want to keep my assets in the resources folder of the core
project. Depending on core
from desktop
works just fine, as libGDX is happy loading the assets from the packaged JAR root. On Android, however, libGDX expects the assets to reside in the assets
folder of the packaged Apk.
How best can I configure my multi-project build without tight coupling among projects?
Possible solutions
One
Store the assets in an assets
subfolder in the core
project, so that they magically end up in the assets
folder of the Apk when packaged.
Two
Publish two separate JARs from core
; one with classes and one with resources. Or separate the core
project into two. Then, in android
, somehow add the items in the resources JAR to the Android plugin's assets
SourceDirectorySet
and remove that JAR from the classpath (so that its items are not redundantly included into the APK). I don't know if this is dangerous.
Three
Add the android-library
plugin to the core
project and export an AAR. I'm sure this would be most compatible with android
, however, I do not know how I would then get a normal JAR for the desktop
project.