Hey fellow developers!
Welcome to the beginning of LibGDX for Android tutorials. In this tutorial, you will learn how to download, setup and create a new LibGDX project in Android Studio.
At the end of this tutorial, you will:
- Download LibGDX
- Setup LibGDX
- Create a new LibGDX project in Android Studio
So lets get Started!
Download LibGDX
First of all, lets download LibGDX. (I am assuming that you already have Android Studio.)
- Go to official LibGDX website.
- Go to Download
- Download (Duh!)
- And open the folder
This process is given here
Now, we will setup LibGDX for our project.
Setup LibGDX
Now, we will setup the LibGDX project using the downloaded gdx-setup.java file.
- First of all, fill in the basic project information
- Run gdx-setup.java
- Provide your Project name.
- Provide package information according to your settings
- Game Class is the java class file name that you will eventually be working with.
- Destination is where you will work on your project.
- Android SDK is where your Android SDK is installed. Give its path.
- Sub-Projects is where you provide the platforms that you wish to support.
- Chose Android
(Only because this is an android based tutorial. But you are not limited to that.)
- Chose Android
- Extensions is where you tell the setup what extensions to load.
- For simplicity, just chose Box2d
(you can learn more later)
- For simplicity, just chose Box2d
- Press Generate
- Wait until the download completes.
Here is the screen shot of my completed setup.
This entire process is given below.
Now, we will open this project in Android Studio
Open in Android Studio
Follow these steps to load the LibGDX project in Android Studio
- Open Android Studio
- Click Import Project
- Here is how
- Here is how
- Give path to the LibGDX download location (which you provided in setup) and press OK
- Here is how
- Here is how
- Wait till the project is loaded in Android Studio
This entire process is given below:
This is it. You have just loaded LibGDX in Android Studio. Now lets run it in Android Virtual Device 😀
Run LibGDX in Android Virtual Device
Follow these steps to run your new LibGDX project in AVD
- Launch your Android Virtual Device (AVD)
- Press the Run button in Android Studio
- Now, the app will run on your AVD. Done!
This process is given below:
This is it. You have just created and run a new LibGDX project in Android Studio.
Lets draw some shapes in the next tutorial.