Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Google Play Game Services, Intellij, libgdx

Where I am exactly after finding some info :

  • The BaseGameUtils folder is in my root folder.
  • google-play-services_lib is in my root folder
  • my settings.gradle is modified to : include 'desktop', 'android', 'core', "BaseGameUtils" as I'm using only the Desktop and Android projects
  • added compile project(":BaseGameUtils") to my build.gradle as an android dependency

I'm new to the gradle concept and so, I'm kind of lost at the moment. I coulnd find any tutorial for Intellij, most of them are for Eclipse. Some help will be really appreciated =)

EDIT 1 :

After a few more hours of test, this is what i got.

Import the project created with the Libgdx's Setup with the advanced option "IDEA" checked into Intellij. (Load Gradle via the popup when intellij starts) [Is this really needed ?]

Set up BaseGameUtils :

Move BaseGameUtils folder into the root folder of your project. Add BaseGameUtils as a module into your project. Add the google-play-service.jar to the BaseGameUtils module.

Set up the Android Project :

Add BaseGameUtils to the Android project as a module dependency

This is where I'm getting lost :

Create an interface in the core project, add to it the functions located in the BaseGameActivity. Make the Android project's main class "AndroidLauncher.java" implements GameServiceInterface and the GameHelperListener. Add to the Android project's main class "AndroidLauncher.java" the missing Methods.

like image 243
Ploppy Avatar asked Dec 29 '25 21:12

Ploppy


1 Answers

There is a tutorial on libgdx wiki.

Installing the "Google Play Repository" from Android SDK manager should be enough. There is no need to move the google-play-services_lib folder.

My android project definition in root/bulild.gradle:

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile project(":libraries:BaseGameUtils")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        compile 'com.android.support:appcompat-v7:20.0.+'
        compile 'com.android.support:support-v4:20.0.+'
        compile 'com.google.android.gms:play-services:5.0+'
    }

}
like image 117
yigiter Avatar answered Jan 01 '26 10:01

yigiter