LibGDX project doesn't build with Gradle version over 2.9
See original GitHub issueWhen trying to build the libGDX project from source using a Gradle version higher than 2.9 the following error message appears:
Error:Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /XXXXXX/git/libgdx/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip.
This is because of a limitation on the version of the Android Gradle plugin (com.android.tools.build:gradle) that is set to 1.2.3. The fix to support Gradle 2.10+ was introduced on version 1.5.0 of the Android plugin (this is the fix https://android.googlesource.com/platform/tools/base/+/b96ce169b385d006cfccc4c9f1e54ab47140f59d).
But if we set the com.android.tools.build:gradle version to 1.5.0 a new error appears this time:
`Error:(272, 0) Your project contains 2 or more modules with the same identification com.badlogicgames.gdx:gdx-box2d at “:extensions:gdx-box2d” and “:extensions:gdx-box2d:gdx-box2d”. You must use different identification (either name or group) for each modules. Open File``
This error also appears just by setting the com.android.tools.build:gradle version to 1.3.0.
So, if I haven’t made a mistake on my tests of course, libGDX is currently stuck on pretty old versions of Gradle and Android Gradle plugin versions until a fix for the box2d modules is found.
Also it looks like the information on the versions page regarding the Android Gradle plugin is not correct https://libgdx.badlogicgames.com/versions.html.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Just for reference, I also stumbled on this
Your project contains 2 or more modules with the same identification
issue when building libGDX using Gradle (and trying to make the Android plugin and Gradle versions match the ones used in libGDX projects).It is caused by the structure of the libGDX source project (or, in a more snarky way, by the Android plugin adding arbitrary constraints in newer versions): from version 1.3 onward, it seems the Android Gradle plugin doesn’t like when a submodule and its parent share the same name (actually, group + name), like :extensions:gdx-box2d:gdx-box2d, or :extensions:gdx-controllers:gdx-controllers. It doesn’t seem this check can be bypassed, so if the plugin is to be updated one day, some renaming or restructuring for those two modules would unfortunately appear necessary. : (
Some additional information on the subject: http://stackoverflow.com/a/33531721
With Android Studio strongly recommending updating to Gradle 2.14.1+ (and Android plugin 2.1.3) at every Gradle project sync, which of course breaks the build, this should probably be addressed soon.