Setting the Project Up
If you want to work on the code of libGDX itself, you need to get it set up on your local machine. For this, Android Studio is strongly recommended as IDE!
If you want to submit code back to the project, please also take a moment to review our guidelines.
- Fork libGDX and clone the repo:
git clone git://github.com/libgdx/libgdx.git cd libgdx
If you want to reduce the size of the download, do a shallow clone (e.g.
git clone --depth 1 https://github.com/libgdx/libgdx). To automatically initialise and update the submodules in the repository (i.e. FreeType) pass the
--recurse-submodulesargument. Please be aware that some of the generated filenames are rather long, which can lead to issues (i.e.,
error: unable to create file [...]: Filename too long) if your repo is located in too many subfolders.
- Fetch the native binaries, which were built on the snapshot build server. Even if you plan on building natives later yourself, it is recommended to bring these down so you can test your development environment is setup correctly before moving to the next step.
Importing the project:
a) Via IntelliJ/Android Studio:
- File -> Open -> libGDX root
- Import all projects
- Wait until everything is synced and indexed
- View -> Tool Windows -> Gradle, sync gradle button
- Make sure the Gradle sync succeeds, if not resolve the issues at hand.
- Go into preferences and turn off configure on demand
b) Via Eclipse: File -> Import -> Gradle -> Gradle project
If you don’t want to use Gradle in Eclipse, executing
./gradlew cleanEclipse eclipsewill generate the necessary project files.
- File -> Open -> libGDX root
You can optionally change the IntelliJ IDEA Gradle configuration to
Build and run using IntelliJ IDEA instead of Gradle. This significantly reduces the time needed to start a test.
If you encounter any issues while setting up your development environment for libGDX, please join our community on Discord to ask for help.
If you set everything up correctly, you can try to give the libGDX tests a go.
LWJGL/LWJGL3: Run the
LwjglTestStart class located in tests/gdx-tests/gdx-tests-lwjgl/src (or tests/gdx-tests/gdx-tests-lwjgl3/src respectively) by right clicking and running. You should get assets not found when you try to run a test, so edit the run configuration and point it to the correct assets folder (
tests/gdx-tests-android/assets). For IntelliJ:
You can directly run individual tests and/or configure the test starter by setting its program arguments:
[options] [Test class name], possible options being:
--angleenables the Angle emulation (default is disabled)
--gl30enable GLES 3 with core profile 3.2 (default is GLES 2.0)
--glErrorsenable GLProfiler and log any GL errors (default is disabled)
Android: Use the following command to install the tests on the test device:
GWT: To access the tests at
http://localhost:8080/index.html, start a local server as follows:
To use your local changes in another project, you can install libGDX to your local maven repository by running the following command:
This will build and install libGDX and all core components to your local maven repository with the current version declared in the gradle.properties file. If you are working with an older branch of libGDX, try
mvn install instead. If you want to include a local libGDX project as dependency without having to publish it after every change, add
includeBuild "<path-to-libgdx-repo>" to a
settings.gradle file in your other project.
If you want to build the libGDX natives yourself, you can find instructions here.