Libgdx goes Gradle: New Setup UI and Intellij IDEA support

Here’s the new hilariously bad setup tutorial video

We’ve been hard at work in the last few days to finish up our new setup UI and the way libgdx projects are organized. Starting today, all libgdx projects can be compiled and packaged via Eclipse, Intellij IDEA and the command line. This was made possible by using Gradle, a build and dependency management system that’s also used by the latest Android development tools. This new setup has a few benefits:

  • Develop with Eclipse, Intellij IDEA and command line
  • Continuous integration by packaging your apps on the command line/shell
  • No more jars, just specify your 3rd party libraries in the build.gradle file
  • Switch between libgdx releases and nightlies by setting gdx.version in the build.gradle file
  • GWT Super Dev Mode is now the default run mode

Follow these steps if you want to give it a try:

Changes for existing Eclipse users

If you want to migrate to the Gradle based build, you’ll have to generate a new project and move your code and assets over. We do not provide a converter as that’s a huge, error prone task.

You also have to install a new plugin called the Eclipse Gradle Integration by Springsource. This makes Eclipse understand Gradle based projects. You can install it via this update site:

Note that the way GWT projects are executed has changed. We now invoke a Gradle task to run super dev mode instead of promoting the use of the normal Dev Mode, which is extremely slow and doesn’t represent the Javascript compiled behaviour of your app.

Also, there are not linked assets folders anymore! This means that you have to set the working directory of your desktop project to android/assets/!. If you don’t do this, your desktop app won’t find your assets.

You will also notice that there are no JAR files anywhere anymore, neither are their any native libraries. This is all managed by Gradle. The JAR files are stored outside of your project’s directories. This is nice as the JARs and native libraries will never polute your version control system!

Another upside is that it’s now super easy to switch between release and nightly builds. The build.gradle file in the root directory of your app has a constant called gdx.version. Just set it to whatever you want, e.g. 0.9.9 for the last release, or 1.0-SNAPSHOT for the latest nightly.

If you work with nightlies, you’ll get the latest version every time you update your Gradle project automatically!

We will still feature the old gdx-setup-ui for a while, but be warned that this will go away eventually!

Now go and give it a try. Please report any issues you have on the issue tracker!

97 thoughts on “Libgdx goes Gradle: New Setup UI and Intellij IDEA support

  1. Nice! I was planning to use the maven archetype for our next game, but this is even better. Good work!

  2. What are the benefis of gradle over maven? Im not familiar with gradle at all but i think maven can do the same things

  3. FINALLY! Eclipse guides were everywhere, including for RoboVM, but once you try IntelliJ for a few days you won’t go back to Eclipse.

  4. I’m having problems that maybe someone that know more about all this than I do can help me with

    I”m using Ubuntu and eclipse Kepler Version: Kepler Service Release 2
    Build id: 20140224-0627

    When I use Help->Install New Software and paste in

    I get this error

    An error occurred while collecting items to be installed
    session context was:(profile=epp.package.standard, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
    No repository found containing: osgi.bundle,org.apache.commons.codec,1.8.0

    So how do I find the bundle?

  5. It Would be nice to keep old for offline mode setups, I am having internet problems sometimes so also download limitations.

  6. Honestly Intellij-Idea is awesome, I once tried and after that I can not go back to eclipse, I addicted to it.

  7. In case someone else has this problem here’s what mine was

    In the instructions I read it said to click on Extensions / Gradle Integration “AND NOTHING MORE”

    I looked at what was in the second option (I can’t remember what it was called) and there was updates for the missing repositories.

    Selecting both enabled me to complete the install.

  8. I have a problem importing project into Intellij on OS X Maverics. Robovm gradle plugin gives me error “Unsupported major.minor version 51”. I do have java 7 installed and running. But still its not working.

  9. Hopefully not another stupid question of mine but my project is a desktop-only game: am i required to setup the Android SDK anyway?

  10. Im getting this error while importing the project into intellij on my mac:

    Cause: com/github/jtakakura/gradle/plugins/robovm/RoboVMPlugin : Unsupported major.minor version 51.0

  11. JVMVersion should be set to 1.7* in /Applications/IntelliJ IDEA 13 .
    At least, that worked out for me.
    Also ensure that the SDK is set to 1.7 in the ios project. Also the dialect dialect.
    To import the 1.7 SDK, use /Library/Java/Home as Java home, as this is the standard for >1.6.

  12. Run from the command line: ./gradlew –version, it will show you what version of Java gradle thinks it should be using. If this is wrong, you need to change your JAVA_HOME variable to the right location.

  13. You can remove the sub-projects that you don’t want after you have generated. It will soon be modular so you can choose which projects you want to have and what dependencies too. Just need to know that its stable for now .

  14. I’m getting this error when trying to build the gwt:

    Compilation failed; see the compiler error output for details.
    Could not execute build using Gradle distribution ‘’.

    The stacktrace returned errors on some Box2DLight classes, even though they run without errors on the DesktopLauncher.

  15. Thanks guys, i’ve managed to fix it by disabling robovm first from, and enabling it after importing the project.

  16. I’d like to be able to specify a specific nightly version. Before, I could update to latest nightly when i wanted to. Now, I either have to use release, or download the new nightly everyday…

    The later doesn’t suits me for some reasons:

    – bigger loading time
    – forced to deal with eventual API changes whenever I open Eclipse
    – for dev teams, it’s nice to ensure everyone uses the same nightly

  17. You can stop gradle pulling in each nightly yourself by putting gradle into offline mode. You also have full control on how often gradle will keep on the cached version of nightlies. It also does not stop you from using the jars as usual.

    As for build times, you could always opt to keep Gradle outside of the IDE, and invoke it when you want, not when your IDE wants.

  18. Thanks 🙂 I also understood that using the nightlies is more about having the last version all the time, not really once every month like I used to do

  19. Yeah, hopefully we can have more frequent releases, as Nightlies are too bleeding for some, and the releases way too out of date.

  20. I can’t get my assets to export with my Jar in Eclipse. I noticed it says to set the working directory of my desktop project to the android/assets folder, which I did in my launch configuration. Is there another way to do it?
    I can run the game in Eclipse just fine, but not when I export it because the assets aren’t exported as well.

  21. So now we can’t hot swap code in IntelliJ? That’s what seems to be the case for me. Each tiny change I make has to go through an entire rebuild. This is a nightmare!

  22. I try to generate my IPA with $ gradlew ios:generateIPA from commandline but I receive this error:

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ‘:ios:createIPA’.
    > No @Marshaler found for parameter 3 of @Callback method

    I have unpacked the lastest robovm release under Downloads, and I also updated robovm eclipse plugin. All to 0.0.11.

    My build.gradle is configurated with roboVMVersion = “0.0.11”.

    What could be the problem?


  23. I didn’t have to set the working directory of desktop project to android/assets/ ??? It worked right off the bat when I ran it. The gdx-setup-ui.jar makes a project that did not import correctly, had to use gdx-setup.jar! How do I add in the tween engine now (where exactly is it supposed to go?)

  24. when every I try to import a new project into eclipse it fails and gives me an error java.lang.NullPointerException Please Help i have my JAVA_HOME pointing to my JDK

  25. Really not easy for user. Really suggest using back gdx-setup-ui-3.0.0. Gradle is not easy to use by beginner and very time consuming to figure out how to correctly install gradle

  26. Gradle is damn difficult to used. I prefer using back setup UI 3.0. Clean and easy to use

  27. Wow, what a crappy surprise after a few months of not following libgdx development. Gradle is so sh*tty I can’t believe anyone’s using it voluntarily. Project creation and import takes *hours* on slower connections. Stupid Gradle downloads everything twice (once when creating a project and again when importing it to Eclipse) and it downloads lots of unwanted packages. I used to love libgdx so seeing that it became a bloatware is heart breaking for me.

  28. You can still use the old way of setting things up. Going forward Gradle is the best option there is i’m afraid. Nothing is perfect.

    Also, congrats for voicing your concerns anonymously!

  29. You don’t have to install Gradle at all, that’s the trick. We put a lot of effort in documenting the entire process for all supported IDEs, please check the wiki.

  30. Hi Mario!! I dont know how to contact you otherwise.

    I wanted to say that Gradle should not be advertised to be used in the IDE for beginners (as you are advertising in this For Beginner tutorial).
    This could close the door to a lot of new users.

    To have Gradle working in the IDE leads to very long, or even infinite loading time to run the game and can lead to a lot of building problem. These problems are just incomprehensible for a new users. This, ultimately, makes run away frustrated beginners who just don’t understand what is wrong with themself or with LibGDX. Whatever you used Eclipse or IntelliJ, if you’re a beginner, you don’t know what is going on.

    If you can’t open your packet of crisps, whatever they are told to be the best of the world, you will finally give up and look for another packet of crisps you can open.
    This is a shame, cause we all know that libGDX is a very good framework, and easy to use. The first contact with libGDX, its front door, should be made and advertised to be easy-to-open.

    The “real time” dependency management should be advertised for advanced users, who know what they are doing with Gradle and Marven in their IDE.
    (Myself I’m a beginner, I’m even not sure of what Gradle is doing when it is used inside the IDE, but I’m happy to have found a way to get ride of Gradle)

    Gradle is useful for the beginner to set up a project and to construct it with ‘gradlew idea’ or ‘gradlew eclipse’, then, the beginner, will open his project without linking it to his IDE-Gradle-plugin. To not connect your project to Gradle in your IDE will help you to keep your hair on your head as a beginner.
    The procedure is well explained in this providential post which saved me :

    I’ll also take advantage of this post to thank you very much for your work on LibGDX which is really a wonderful framework.

    Have a good day 🙂

  31. I am somewhat new to libgdx and decided to try my first serious project with it. However, coming back to it, the setup tool is obsolete and I am trying to install the Gradel extension into eclipse, but I get teh following error: An error occurred while collecting items to be installed
    session context was:(, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
    No repository found containing: osgi.bundle,org.json,1.0.0.v201011060100

    I get this when I try to get the extension from:
    Didn’t try the nightly builds.

  32. A couple years ago, I complained right here in this comment section about the lack of maven artifacts. Now I get to say Thank You!

  33. Great to see you have moved to a dependency management system. I haven’t had a chance to upgrade to this approach yet, but it is a nice step forward. My only _small_ complaint is that you used Gradle instead of Maven, but mostly just because I am intimately familiar with Maven 🙂

  34. Hello,

    It is for me but I still have this error …

    I am working With IntelliJ 13.1.2

    My JAVA_HOME :
    echo $JAVA_HOME

    My Java version :
    > java -version
    java version “1.7.0_55”
    Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

    My Gradle version :
    gradle -version
    Gradle 1.12
    Build time: 2014-04-29 09:24:31 UTC
    Build number: none
    Revision: a831fa866d46cbee94e61a09af15f9dd95987421
    Groovy: 1.8.6
    Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
    Ivy: 2.2.0
    JVM: 1.7.0_55 (Oracle Corporation 24.55-b03)
    OS: Mac OS X 10.9.2 x86_64

  35. Hey Geoffrey,

    I usually work with Gradle outside of the IDE however I would say that this is the more advanced approach. The IDEA and Eclipse Gradle plugin (The plugins that create the IDEA and eclipse project files from the Gradle project) are not always spot on and debugging those issues are far more challenging than using a Gradle plugin in the IDE.

    It also would mean that for users to run their packaging tasks/sub projects that their IDE wouldn’t support, like SuperDev in the HTML module, they would need to be familiar with how to do so on the command line. It sounds silly, but not as many users are comfortable on the command line as they probably should be.

    In my opinion, one of the best things about LibGDX is the time it takes you to get up and running, most of the issues that plagued the transition to Gradle have been ironed out, (Better documentation, bug fixes) unfortunately user ignorance will still be there though 😛 The time to get up and running is super quick for all sub projects, for html that is quite amazing. Due to this, I would say priority #1 is getting up and running, and fixing workflow issues should be priority #2.

    As a side note, making this the default option would not be helpful for users that dont use Eclipse or IDEA, and they are out there, and very happy about not having to be restricted to an IDE.

    I am currently working on a wiki article for exactly this purpose, improving workflow once you are using a Gradle managed project:

    Thanks for the constructive feedback and sharing your experiences so far and let me know what you think if you get a chance to read that article.

Leave a Reply

Your email address will not be published.