How to setup Libgdx for Android Studio

libgdx android studio

Some Background Information

I am in the process of writing a programming tutorial series about billiards. It will use Java as the language, Android Studios as the IDE, and libgdx as the supporting framework.

Also, if you have already setup LibGDX for Android Studio? Head on over to my newest tutorial about custom bitmap fonts. In it, you will learn how to make fonts that can be used in your android apps.

Android Studio welcome screen

Android Studio is the next eclipse, but better. That is why we are going to use it.

What is Android Studio?

Android studio is an IDE for Android developers. First announced earlier 2013, it has since grown to be a very effective tool. Last month, June 2014, Android Studio has went from alpha to beta. If you wish not to use an ‘in progress’ IDE, your other option is Eclipse. But hey, out with the old and in with the new. Source:

Unlike Eclipse, Android Studio is, in my own opinion:

  • Faster
  • Responsive
  • Visually unified
  • More productive


What is libGDX?

I like to call it a convenience. It is like XNA game studios for Android developers. It integrates easily into Android Studio, is cross-platform, and is super-fast. For a full detailed list, visit their feature page

How to install Android Studio Beta

If you do not have Android Studio installed, you should do some research into it. I suggest going to the android developer homepage. I will not go into great detail about this. Also,make sure to read the Terms and Conditions of anything you use. It is your obligation. Without doing so, you never know what you are getting into.

Download and install Android Studios Beta.

Android Studio Download Page

Welcome to Android Studio.

Download and install the Java Development Kit.

Java Development Kit Download Page

Say hello to the JDK

After everything is finished, open the Android SDK Manager and add the packages that you need. My Suggestions:

  • Install the packages it wants you to install by default
  • Install all Android SDK Build-tools installed
  • Install the SDK Platform and SDK Sources for each android (API Lv.) Installed
Android SDK Manager

Look at all the packages! This might take a while to complete

4. Go to File>Settings. Under the Appearances tab, select Darcula Theme and Hit OK.

Android Studio Darcula Theme

Reduce Eyestrain with the sleek Darcula Theme. Oh Yeah!


How to correctly setup libGDX

It took me three days to figure this out. I am letting you do it in one day.

Go to the libGDX download page and download the setup app. This file will generate an Android Studio Project with all the necessary libgdx libraries and cross-platform modules for you.

  1. libgdx setup app

    This is the only file you need to download

  2. Click on the download file and save it to your computer.

    gdx setup jar file

    Save this file to your computer

  3. Open the jar file. Then, fill in the dialog box as follows:
    1. Leave Name: unchanged
    2. Leave Package: unchanged.
    3. Leave GameClass: unchanged
    4. Go to your \AndroidStudioProjects Folder in the Library Explorer and create a new folder called \SetupGame. This is where our new project will be generated.
    5. Change Destination to:
      1.  C:\Users\<USER_NAME>\AndroidStudioProjects\SetupGame
    6. Change AndroidSDK to:
      1. C:\Users\<USER_NAME>\AppData\Local\Android\android-studio\sdk
    7. Leave all Sub Projects: checked
    8. Uncheck the Box2d Extension unless you know you are going to use it.
    9. Click Generate:
libgdx setup project setup

Do not worry, it is not as complicated as it looks

4.   From the Android Studio welcome screen, click Import Project and select: C:\Users\<USER_NAME>\AndroidStudioProjects\SetupGame\build.gradld. This is going to open up the project for us.

Import Android Studio Project

Here you see the build.gradle file you need to import.

5.   DO NOT PANIC. You will get this screen saying there is an error. This is easy to fix.

libgdx import project error

As you see, there is an incompatible version begin used.

6.   In your Library Explorer,

    1. Navigate to C:\Users\<USER_NAME>\AndroidStudioProjects\SetupGame.
    2. Right click on the .idea folder
    3. Delete It.

Thank you Drasco Saric for adding this one step. You are the best.

.idea folder delete

Simple isn’t it. Just delete the .idea folder.

7.   Back in Android Studio. Press (Ctrl+Alt+Y) to synchronize your project. A new .idea folder will be auto-generated with the correct contents. Honestly, I do not know why it does this. I just know that it works.

8.    Double tap on any of the file breadcrumb tabs to open up the project file viewer screen.

Android Studio fileviewer

Doesn’t this look so clean. Anyway, this is what you will see on the left-hand side of the screen.

9.   Now open up your MySetupGame/build.gradle file and make one small change.

Change: classpath ‘’ to …0.12+’

build tools version

Yup, simply change that 0.10 to 0.12+

10. Sync your project again

sync project

You should see this message appear at the top of your screen.

If you do not get any errors, this is a success. you now have now setup libgdx for Android Studio.

Post Android Studio Setup

Now that you have your project correctly setup, here are a few things you should do.

Copy and Paste your SetupGame Project somewhere as a backup.

If you want to change the package name, right-click on it and select Refactor>Rename.

Rename Package

Android studio has amazing refactoring tools.

To build your project, I highly suggest that you use a real android device, not an emulator. This is because they are really slow. Here is how to access the developer options on your phone.

1. Go the phone settings, scroll to the bottom, tap About Phone, scroll to the bottom, and tap the Build Number until it says that you are already a developer

Android Phone Developer

I think the process of accessing the developer options is like a secret code.

Now in your settings, go to developer options and turn them on. Also make sure to enable USB Debugging. In Android Studio, run the program and select the connected device. You might be asked for permission to do so. BOOM! This is what you should see:

badlogic libgdx setup app

Amazing! You just created your first app.

If you want to build your project on other platforms, just follow these simple steps outlined on the wiki

That is it!

If you followed this post to the very end. Congratulations. If you have any questions comments or concerns, feel free to leave them in the comments below. Happy Coding. Enjoy!



So I recently generated a

new project and a new error occured. It says somthing along the lines of:

“../gradle1.10-all requried, try changing ../gradle2.0-all in destination ulr”

Go to /gradle/wrapper/gradle-wrapper-properties

Change: the distributionUrl to

distributionUrl =http\://

zip Android Studio LibGDX

This is what my screen looks like.

Sync You project, it should take about 5 min. to fix. At least that is what it did for me.



How to setup Libgdx for Android Studio — 6 Comments

  1. Pingback: Billiards Game Programming Part 1 - Programming Money

  2. Pingback: Billiards Part 3 – Android Studio Display Class - Programming Money

  3. Thank you so much for this post. Unfortunately, I didn’t see it until I’d already spent days trying to fix it myself… But I finally came across your post and got it working! Thanks!

  4. Thank you very much! LibGDX official don’t support Android Studio? That’s bad. How to correctly create buckup project? Need often copy and paste original files that sometimes refuse to work.

    • Android Studio support for LibGDX… Yeah, it is kind of bad isn’t it. But I am sure as time goes on, more support and help will appear on the web. As with backing up projects, I usually just copy and paste the entire project into a folder, and append the end with 1..2..3. If the files do not seem to work, at worst, I would just copy and paste the java files in a new project. Android Studio is really good at refactoring and renaming code (i.e. press F6 on a variable).