Skip to content
Mario Zechner edited this page Mar 23, 2014 · 19 revisions

You just generated your libgdx project, now it's time to start developing its guts in Eclipse! Before you can import your project into Eclipse, make sure you setup your development environment!

Importing Your Project

Go to File -> Import -> Gradle -> Gradle Project, click Browse and navigate to the root folder of your project, then click Build Model. After a while, you'll see a root project and subprojects (android, core, desktop, gwt, ios). Select all the projects and click Finish. Note that this process can take a minute or two the first time you do it, as Gradle and some dependencies will be downloaded in the background.

Running Your Project

  • Desktop: Right click the desktop project, Run As -> Java Application. Select the desktop starter class (e.g. DesktopLauncher.java). The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory!
  • Android: make sure you have a device connected and that it shows up in DDMS (see Android Developer Guide). Right click your Android project, Run As -> Android Application.
  • iOS RoboVM: Right click the robovm project, Run As -> iOS Device App to run on a connected device, or Run As -> iOS Simulator App to run on the iOS simulator. If you run on a device, you need to provision it to be able to deploy to it!
  • HTML5: Right click the gwt project, Run As -> Gradle Build .... Select superDev mode from the list, click Apply and Run. You can now follow the build process in the console. This will take a while, as your Java code is compiled to Javascript. Once you see the message The code server is ready, fire up your browser and go to http://localhost:9876. Drag the Dev Mode Onbookmarklet to your browser bar. You only have to do this once! Next, go to http://localhost:8080/gwt. This is your app running in the browser! When you change any of your Java code, just click the Dev Mode On bookmarklet while you are on the site and the server at port 9876 will recompile your code and reload the page!

Debugging Your Project

Follow the steps for running the project, but instead of launching via Run as, launch your configuration via Debug as. Note that RoboVM currently does not support debugging. Debuggin of the GWT build can be done in the browser as follows:

Run the superDev Gradle task as before. Go to http://localhost:8080/gwt, click on the Dev Mode On boorkmarklet and hit Compile. In Chrome, press F12 to bring up the developer tools, go to the sources tab and find the Java file you want to debug. Set breakpoints, step and inspect variables using the power of source maps!

super dev mode

Packaging Your Project

It's easiest to package your application from the command line, or using the Gradle tasks from within Eclipse. To see the relevant Gradle tasks, check the Gradle command line documentation.

Table of Contents

a note from the translation

Wiki Style Guide

Clone this wiki locally