Libgdx goes Gradle: New Setup UI and Intellij IDEA support

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

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!

Before importing the libgdx template into IntelliJ I first had to create a new IntelliJ Android Project so that I could specify where the SDK was (yes, I had ANDROID_HOME set). Otherwise I would get ‘Cannot find SDK’ errors. Interestingly, I could load the SDK manager from within IntelliJ, but I could not load the AVD manager.

After I had done this, I deleted the dummy project I just created and I imported the libgdx one – it worked fine.

milan

when i am trying to import the project in eclipse which i just succesfully created with libgdx i am getting an gradle import build error. But when i just leave every name standard in the libgdx create a project part then it is working fine.

Could somone please explain to me if i can change the package name and game name cause at this point only my-gdx-game is working.(and i want it to change to something else.)

thanks in advance! 😀

Lord Super

How can I get rid of that gridle s***? It annoys me to have yet another plugin in eclipse and all this automatic managment of the libs is just totally unneccesarry. I appreciate your effort but it would have been nice to still have the option to do it the old fashioned way….

Fist of all, let me say that I love libGDX. It’s an awesome framework on which I hope to build the next big app for android/ios (and eventually Windows Phone?).

That being said, the only issue I’m having with libGDX is the fact that it changes so much. By the time a tutorial explains to me how to do something it is no longer relevant to the new version of libGDX. Just as I was getting the tilemap and camera stuff down, it was completely different in the new libGDX version. Once we got used to using the old setup ui, you changed over to Gradle. Honestly, I don’t know if I should learn Gradle now (which seems to me to be overly convoluted for the little help it gives me) or just wait until you get the next new thing. LibGDX doesn’t seem stable to me but open to the whims of the upstream team. As their currents ebb and flow so must the rest of hang on to the raft for dear life or get out of the river completely. Please, just set a direction and move there and let the waters settle for a little bit. If you want to experiment with new things (and you should), let us know which new iteration of the framework will hold the much appreciated LTS (long-term support) moniker. And how long will it be supported? A week? A month? Now, it seems to be every two weeks where a new short-term release is built.

I just hate how many times I’ve had to redo something I had working perfectly because the upstream turned while no one was looking and splashed me with obsolescence (to continue with the tired metaphor from before).

Nick

I updated to 1.0.2-snapshot and I now get the error:
Couldn’t load shared library ‘gdx-controllers-desktop64.dll’ for target: Windows 7, 64-bit

Is there a gradle task I need to run?

badlogic

You can’t expect to stick to upstream and have no changes hitting you. That’s what releases are for. We increase the frequency of releases so you can stay as current as you want. We signal API changes in the version number so you know not to update. TLS is something we won’t do, for that our resources are way to limited.

We are not in control of external tutorials. We do make sure our own documentation is always up to date.

As for API changes, the maps UI hasn’t changed in over a year. I also don’t remember any other huge changes apart from removing GLES 1.x support (announced months ahead) and the viewport addition to stage.

The old setup-ui was available for over 2.5 years. We told people multiple times that we’ll switch to Gradle over a period of 6 months.

I guess we’ll never make everybody happy. It is kind of tiring to have people bemoan our efforts to make things better without contributing themselves.

badlogic

Why do you think reporting an issue like that on a 2 months old thread is a good idea? Why don’t you use the issue tracker and or the forums?

Nick

Late on a Saturday, gotta be honest, I was kinda drunk. Thanks for the response.

William “Bill” Gaits

First of all, sir, if I had the ability to contribute to this great project I wouldn’t need external tutorials to use it. The reason I go to those tutorials is because either the official documentation is not complete (there is a great deal that isn’t complete even now), or the bits that are complete are written in Klingonese (tlhIngan Hol) where a person like me has no hope of comprehending what it means. I have tried several times.

I am happy with libGDX and now that I (a complete beginner and idiot) has Gradle up and going, I like the new version (save for the change of the awesome libGDX png for the distasteful badlogic one for new programs). I wrote my previous comments because I became discouraged when I went to the badlogic website and saw that nearly every aspect of the setup I was using was now no longer correct. I don’t think about changes that may have been made while I’m coding and so it seemed to me that multiple changes had been made to which I was unaware. I wonder if there could be a news RSS or some other way a person could get information from the libGDX team as it happens rather than to find out after the fact? You say you announced gradle for 6 months? I hadn’t visited the libGDX site in that time or, if I did, I did not see that announcement.

Still, I appreciate your efforts in bettering this framework I just wish that there was a way to get those announcements of impending changes delivered to me while I’m coding. Even new versions go by without my noticing. I didn’t even know that you had released version 1.

The only things I dislike at this moment (aside from the png mentioned earlier) is the fact that the new gradle creation setup doesn’t remember the location of the SDK from one use to the next, and that the assets folder remains stubbornly in the Android folder. I always move the assets folder from Android to the core project (where I think it belongs) and link to it in the other folders.

I love libGDX and badlogic games enough that the members of my team (which is my as-of-yet-unincorporated production company) has already agreed to set aside a certain percentage of any profits made via the sell of our game creation to be donated to the continued support of the upstream team of libGDX. It may never amount to much (as again I’m a complete beginner and idiot) but it’s the best we can do. We do not have the knowledge to contribute in any other way.

badlogic

Maybe some other technology suites you better. Check out Unity or Cocos2D-x, maybe there way of announcing things suites your workflow better.

http://asidik.com/ Tomski

It is hardly the fault of the LibGDX team that you don’t follow announcements. A weekly check in on the blog, or the news section on the website would quickly inform you of any important/interesting changes to the api and with the project in general. http://www.badlogicgames.com/wordpress/?p=3198 As you can see, this was announced in September.

If you find some documentation lacking, perhaps post on the forum asking for clarification, and then we can actually do something about it. The docs are written by people that are usually very familiar with the API, and writing a guide using the right language for every user is very difficult, with no specific feedback this will never get resolved, and you will continue to use out of date tutorials that are beyond the control of the project.

By the way, the setup uses the ANDROID_HOME environment variable, if you set it, it will “remember” what Android SDK you want to use. As for the assets in the android folder, this is required for the assets to be packed into the .apk for your android project. Thanks to Gradle you can put this where you like, but its not always the case for every development environment.

If you want to keep up to date with LibGDX, follow the site, follow the blog, follow @badlogic:disqusgames on twitter. Please actively keep an eye on the project, it is ever evolving, improving, expanding and the API will break. Alternatively, ignore it and please don’t complain when your stuff is now broken, its not fun for us.

Tamas

I shouldn’t be even replying I guess, but here it goes.
William – you keep referring to yourself as a beginner and an idiot. You would be amazed how quickly the latter can be resolved by not exposing this sense of entitlement and by trying to show some common sense and follow the channels everyone is to learn about the changes.
Being an open source contributor means you ALWAYS have to prioritise every second of your life so the community who found value in what you did can profit from it more.
We all appreciate your intention on planning to support the efforts financially but the current state of affairs is that the the premium currency now is time and the need for help is now. Everyone knows how a little time spent on compiling a list of improvements with actionable items and taking ownership of tiny tasks can make a difference. Documentation is a good example.
As for your wish to have the changes communicated to you is fulfilled if you’d take the time and check the about page and the community. You could see the tweets at 3AM with a link to the blog post written at 2AM outlining everything that need to be done to make YOUR life simpler.
You are a beginner in your own words and I agree that everyone who needs spoon feeding is, but once you reach out to get your own spoon you suddenly mature and can feed and guide others.
Many have changed their ways to accommodate changes in the project but if you look deeper then you would see that every change is heavily discussed and debated in PUBLIC through the channels you don’t seem to find. As for the “asset” directory being in the android project. You think it belongs to the core project, I think it took you about 10 seconds to drag it there. There are reasons for it to be where it is and checking the debate logs, you will find that being where it is, benefits 99% of the users, which is not negligible.
I hope you will get your projects finished and to prosper whatever library/flow you’re using but remember that whatever you pick, you need to be helpful towards yourself.

All the best from someone who wishes everything on a plate too and now.

NotComplicatedEnoughYet

You know I’m just a dev, I write code, I don’t work for Eclipse or Gradle. I don’t know how to do this shit. I just want to write my code, run it, and debug it on a mobile device. You guys are making it way too complicated. I’m about go find other alternatives to LibGDX altogether. And replying with “Just follow the wiki” “Just click here” doesn’t help. After clicking through 50 different half-thorough links I’m still getting errors. You guys should know Eclipse is finicky as is, then there’s the SDK, bugs in the JDK, now there’s this new add on, and this other add on, and they all have to align perfectly just so I can write code. I’ve spent as much time setting up these retarded reach around dev environments as I have my own code. Have you guys ever used Visual Studio? When was the last time anyone had to spend more than 5 minutes to run an application on Visual Studio? Quit doing this shit. If it isn’t broke, don’t fix it.

NotComplicatedEnoughYet

Rather than trying to take criticism from users, smugly tell them to take a hike instead! Great way to keep a user base.

NotComplicatedEnoughYet

It’s clearly not the best option if everyone hates it.

NotComplicatedEnoughYet

You know what would be great? If I didn’t have to edit 20 different obscure files just to have a glimmer of hope at getting my dev environment set up, just so I can BEGIN to write my code.

badlogic

Then don’t use IDEA? This is something that’s entirely unrelated to libGDX.

neuromancer85

Dafuq have I just read? O.o

Tamas

Quoting: “You know I’m just a dev, I write code … I just want to write my code, run it, and debug it on a mobile device.”

That is exactly why Gradle was introduced, so you can do just that as quickly as possible.
I’m sorry that the devs just built you a car and with the help of Gradle they parked it under your fussy nose and how did the dare not opening the door and lifting your lazy ass into the driving seat and starting the engine because all you can do is just drive?

badlogic

The number of plugins you have to install is exactly the same as before: 2 (Android + Gradle) plus one more if you want to target iOS (RoboVM). You no longer need to install the GWT plugin. The way plugins are installed is also the same as before. What is the difference in your opinion?

I’d be happy to know which JDK bugs you found. We also provide you with video tutorials should the written wiki articles not be enough for you.

My guess is that you are new to this and a bit overwhelmed. That is fine. You have the option to ask for help on the forums or an IRC. You are unlikely to get help by being rude.

Simon

Liking it so far. I have managed to upgrade/move my current (admittedly small) project without too much grief. Just glad to have dependency management system at all, kudos.

michur

Dude that’s lame. You call yourself a dev and admit you don’t know how to configure simple mobile dev env. I’d rather sit quiet and try to learn.

Jim T

As an outsider, I agree with NotComplicated. I did get Gradle running, but since I need a patched version LibGDX anyway, I can’t really use it (I haven’t found how to use Gradle to patch libraries or even if you can). The problem with a lot of tutorials is that they are written from the perspective of a user that already knows what everything means and how things work. If you don’t already know the answer, they don’t really help. If you haven’t been in the situation of the poster above, then you haven’t done enough work.

That said, I was able to struggle through and got Gradle running. So if you want to use LibGDX exactly how it was intended, Gradle is a good way to go. If you need access to some of the privatized innards (and almost everything is private), then building it yourself is your only option (as far as I know).

As for alternatives to LibGDX, I’ve found that it is the best system for my needs and nothing else comes close. I feel it is definitely worth the struggle to get it going. As an aside, one indispensable part of LibGDX is that you can debug almost everything directly on the desktop with going over to a device or through an emulator. That feature alone saves me hours a day.

Jim T

My 2 cents:

You are right, but that is just the way it is in this market right now. Unity has the same issues. New stuff happens fast and there isn’t much you can do but either stand pat or hold on for the ride. Remember that Android itself is changing even faster. The only think you can do is follow your libraries to keep an eye out for upcoming changes. Twitter how I follow LibGDX, they do a great job of posting information about what they are doing and what is coming up.

LibGDX isn’t any better or worse with respect to updates than anybody else. There have been several lately (open gl 2, views and gradle) but there weren’t any for quite a while. Things will probably settle down shortly and then pick up later (complete open gl 3, who knows what).

Personally I think, like you yourself stated a couple of times, they are doing fantastic work that nobody in the library world can compete with.

Juan Javier Cassani

I’m happy with the addition of gradle and the last changes, I even managed to configure the build.gradle of android project to automatically sign apk and apply proguard (running one task and getting a ready to upload apk, wonderful! isn’t it?), I write just to make it clear, not everybody is complaining like you (and specially the way you are doing), if you start your critic with “You know I’m just a dev, I write code, I don’t work for Eclipse or Gradle. I don’t know how to do this shit. I just want to write my code, run it, and debug it on a mobile device”, don’t expect to be taken seriously (also, I really think that you need to take a hike…)

IMHO if you are too lazy to “learn” (or call it “get used to”) something useful like gradle, just move on to an engine or any other thing that fits your needs.

http://asidik.com/ Tomski

If you are using your own custom branch of LibGDX, you can build it to your own maven local, and it will automatically be picked up by the default build script.

Jim T

That’s a pretty good work around. I would become the supplier of the library to Gradle. It doesn’t seem worthwhile right now when I really only need LibGDX, but if I need to move more of our system to Gradle for some reason, this idea would work out well. Thanks!

Hat

i don’t know why they complained bout gradle… this is just easy to follow through…only lazy people complain?

What the bloody hell is wrong with you people? I haven’t treated you with disrespect. I never once said anything nasty to you. I even came back to this post to explain how I had gotten gradle up and going and liked it. I didn’t know about the ANDROID_HOME variable nor do I know how to set it to make it remember the SDK address. I move the assets folder because I like it better in the core folder and have NEVER once had a problem with it being there and I like it better. I never said anybody else should put it there and I couldn’t give the hairy crack of a rats behind what 99% of other users do with it. I stated that I like it better that way. Me. Personally. I complemented you more that I criticized and those criticisms wasn’t anything major. You think the whole of the world has to believe the way you do and accept everything you want with open arms and the moment someone expresses the slightest frustration you tell them that they should go fuck themselves?

I get blasted for not using twitter? I should remind you that there isn’t anything about getting twitter announcements on the main page nor is there anything about twitter on the community page. Even if it was publicized by you myopic little men (which it wasn’t; not even a little) I still wouldn’t have gotten the information because I don’t use that service. There’s nothing wrong in that. There is no reason to belittle people for it.

As far as a sense of entitlement, I don’t think I showed any such thought process (You all, however certainly have). I don’t feel entitled to anything from you people. I was a loyal user without any trepidation. I even felt bad at your initial response and I wanted to let you know calmly that I had waded through Gradle and was even happy with it now. I didn’t apologize as I still felt my post was apt. You did nothing with this information. You acted as if I had just slapped you and your mother in the face and kicked your puppy. What the hell is wrong with you? Does it make you feel superior? Do you feel better about yourself? I don’t get it.

I just want to point out: I never once said I didn’t want to use Gradle. Nor did I say I didn’t like it’s inclusion into the project. Nor did I say I wasn’t going to learn it. I have been treated, however, as if those things are true.

I don’t know enough about the project to contribute to the documentation. I could parse it for grammatical errors if that is needed but to actually write it out, I couldn’t do anything more than the amount I know. I would be willing to write a tutorial series for the amount I know and keep it up to date with the project. I’ve already started one such tutorial. But it would cover only top-down tiled map games as that’s what I’m using libGDX for and thus it encompasses the whole of my knowledge base. Still, I get the feeling that you want your users to get the project and immediately love every aspect of it (how DARE they not) and know exactly how it all works. You act like we all should be able to drive in Formula One before we even get behind the wheel of a car for the first time.

I was not rude, smug, or crass in writing to you. Of the criticisms I mentioned the worst was the changing of a default image (why did you change it anyway the first was much nicer). I had nothing but overwhelming praise for the project and the dev team. I even put forth solutions so that it was constructive criticism (well except for the image change which I hate). I was even self-depreciating in an attempt to appear respectful. I no longer have praise for the dev team. Your treatment of me in this has been appalling. If I knew where you lived, I’d come round and bone your dog.

Still, I love this project. It is awesome even if the authors are not. I truely hope that you’re not like this in real life. I hope this crass, smug, asshole I’ve read is just an internet persona that is showing frustration because of some of the people’s comments about Gradle.

One final note to Juan Javier Cassani (nice name by the way): If I am reading your correctly, you seem to have replied to NotComplicatedEnoughYet as if he were me. I assure you, that while I echo his sentiments, this is not the case. If I read you wrong, I apologize. And I do understand that I have replied to a few people myself herein while technically addressing my comments to badlogic.

Am I correct in my assumption that badlogic is Mr. Mario Zechner?

badlogic

You are correct in the assumption that badlogic is Mario Zechner. I assume you are now going to seek me out and ‘bone my dog’ as you put it?

I have not done any name calling (like you felt the need to do in your latest post). I first told you why things are how they are and what to expect, and that i’d wish people would contribute if they feel something is worthy of ‘hate’, unstable and at the whims of the dev team, overly convoluted, and so forth (all from your posts).

You went on to say the official docs are incomplete (tell us which parts) and that you are not told about changes. We can debate the former, but the later is absolutely not true. Look here under news and community: https://github.com/libgdx/libgdx. Look here as well: http://libgdx.badlogicgames.com/news.html. At some point it is a users duty to stay in touch with a project.

I did not feel that there was anything i could do for you in my second response other than recommending to check out alternatives. I fail to see what other things i could have said which i did not explain in the previous post.

Barry Rowe

You’re correct. Maven paried with the right plugins can do all the same things. Gradle is just a little more expressive in its build files, and gives you a little more power “out-of-the-box” for minor scripting within said files.

With the way they’ve setup the build files, and using the gradle wrapper, there is little to no real setup involved. You just run the setup-ui, point your IDE to the build.gradle file, and you’re good to go. Command-line builds are now trivial as well, which is great news for anyone looking to setup CI jobs or otherwise automate their development releases.

paulnicholls

So now that we are using Gradle for libgdx projects…how does one add Ouya to a Gradleproject now? I can’t find Ouya or any references to Ouya when I search on the search.maven.org site.

shah

Well can i any more copy paste jar file and do stuffs. i dont know what gradle is!!!!!!

Clay

If you just need the Ouya SDK, I think all you would need is to follow the FileTreeDepency method found here: https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine
The only difference being that instead of the Universal Tween Engine libraries, you would put the ouya-sdk.jar in /libs, and only need to link it in both the core and android dependencies (and since it does use a wildcard to add it should add any files ending in .jar found there anyways, if I recall).

paulnicholls

Thanks Clay, I will give this a try

MadFerret9

The ‘old way of setting things up’ (i.e. copying the jars into my project folders) did not work for me when updating to Libgdx 1.0 because Box2D and physics are not included in the new jars, and I can’t figure out how to get them back. I am guessing I need to change my Eclipse project setup to import them? My problem is, I don’t know WHERE Box2D and Physics are located now. :/

MadFerret9

Maybe it’s easy to set up a NEW project.. but migrating an existing project over to the new version is going to be difficult, and I fear I will wreck my project in this process. I’ll just stick with Libgdx 0.98

Jeroen

Geoffrey, I think you’re right. I’ve been trying whole day to get one successful build. Still didn’t managed with errors like: “could not find any version that matches de.richsource.gradle.plugins:gwt-gradle-plugin:0.5.+” etc. I have no idea whats going on… I used the ‘gdx-setup.jar’ but didn’t work out-of-the-box.

Geoffrey Mégardon

Yeah, I understand that every things work for me now, even the performance problem (long time to load the game/the project) seems to be resolved (but I also got a new config). But I remember at the time I wrote this comment, that was a real nightmare :/

I hope you will get your problem solved from the forum.
They do a lot of work to make libGDX more accessible, I hope you will eventually enjoy the framework

Geoffrey Mégardon

Silly question but why your
“Tips to speed up Gradle if you still want IDE integration”
are not applied directly by the project creator?

It is a bit silly that the beginner has to be confronted to long waiting issues to load his game, then considers it is not normal, has to look on internet, finds your documentation or get lost in Gradle doc or get lost in his IDE doc (the LibGDX documentation is, by the way, always masked/overtaken by https://code.google.com/p/libgdx/wiki/ when you search on google), and then he has to configure Gradle himself.

Yeah, I know, beginners are fucking annoying (excuse my French :P) the worst things is to get them lost/frustrated, and they get lost pretty easily So every single things you can avoid them to do by themself is good to be done I think.

Anyway, the work you (every body involved) made on the documentation is pretty amazing.

http://asidik.com/ Tomski

They are now applied directly, it wasn’t possible before due to some obscure issues. The article should just need some updating to reflect this

Geoffrey Mégardon

Amazing

http://barryrowe.net Barry Rowe

This is true, a new project setup will be easier than migrating an older project. I’m not saying you should upgrade, because you know your workflow much better than me, but if you wanted to upgrade your easiest path would be to create a new project with the new Setup UI, then just copy over your src/ and assets/ directories to the new project.

Guest

How horrible this Gradle setup for beginners…. I’m spending days and days and days just troubleshooting. With every Eclipse, java and LIbgdx update a new issue occurs. I wouldnt know what else to use besides LibGDX (at the moment) but otherwise I would abandon it uimmediately. PLease fix this