question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LibGDX project doesn't build with Gradle version over 2.9

See original GitHub issue

When 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:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Fringalecommented, Aug 12, 2016

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

0reactions
Zomby2Dcommented, Aug 29, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LibGdx doesn't working after updating Gradle (Android Studio ...
Open root build.gradle file and find artifact in buildscript and change version classpath 'com.android.tools.build:gradle:2.3.3'.
Read more >
Updating libGDX
Updting libGDX, its dependencies and the Gradle Wrapper itself is straight-forward. Start by opening up the build.gradle file in the root of your...
Read more >
No source folders when importing Gradle project with ...
After downloading the code and unzipping, I import “Existing Gradle Project” and choose the “libgdx-cookbook-master” as the project root ...
Read more >
libGDX 1.10.1 : r/libgdx - Reddit
Projects created with the nightly gdx-setup can use the latest Android Gradle Plugin version. On stable or older projects the limit is 4.2, ......
Read more >
bug! exception in phase 'semantic analysis' in source unit ...
This is not a LibGDX issue. Gradle 5 is incompatible with Java 13. You either need to update Gradle (the wrapped version in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found