This page shows you how to start with mobile game development using LibGDX and Kotlin based on my example app Splinter Sweets.
Set Up Your Environment
At first, install these applications:
- Android Studio
- Android Studio Plugins (Kotlin, Multi-OS Engine Plugin)
I have not used Eclipse, because Android Studio has a better Kotlin, as well as Android integration.
To get the last version of the Splinter Sweets Example Project, clone the public GitHub repository. To do this, execute the following command or download & extract the zip archive:
git clone https://github.com/reime005/splintersweets.git
After that, open the project with Android Studio. Now you can continue with the the deploy & configuration part.
Deploy and Configure
To build for desktop, use the following run configuration:
Why should you do this? Faster development process than using the Android Emulator / your Smartphone.
To build for Android, simply create a Android Application run configuration, but do not forget to make adjustments, before you submit something to Google Play:
- Change the package name in the Manifest.xml and build.gradle file in the project’s android module.
- Change the Google Play Games Services App ID.
- Replace the google-services.json file with your own.
It is currently not supported to build for HTML using Kotlin (if you really want to, use Java) and GWT (Google Web Toolkit). In my other post I described the reason why. As an alternative, try for example TeaVM as a replacement for GWT.
To build for iOS, use the Multi-OS framework. I will describe this process in the near future.
You should now be able to run the mobile game app Splinter Sweets on Android and Desktop.