Skip to content

Import SDK ​

Integrate the SDK with Android Studio ​

Add Files ​

    1. Place google-services.json from the SDK in the root directory of the game's main project, as shown below:
  • Location for the json file
    1. Place the gdconfig.xml file from the SDK in the game's main project's res/values directory. For details about the gdconfig.xml configuration, see Configure Game Related Information.

step1 Add Google Services ​

    1. Enable Java 1.8 support
xml
android {
...
  compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
...
}
    1. Import and enable Google Services
  • Import Google Services in the root-level build.gradle file
xml
buildscript {
    ...
    dependencies {
		classpath 'com.google.gms:google-services:4.4.4'
    }
	...
}
    1. Enable Google Services at the bottom of the game's main project build.gradle file
xml
apply plugin: 'com.google.gms.google-services'

step2 Add GDSDK Dependencies ​

    1. Import the GDSDK repository in settings.gradle
xml
pluginManagement {
    repositories {
		...
		// Import the GDSDK repository
        maven{
            url "https://repo.gdsre.cn/bale/repo"
        }
    }
}

dependencyResolutionManagement {
    repositories {
		...
		// Import the GDSDK repository
        maven{
            url "https://repo.gdsre.cn/bale/repo"
        }
    }

}
    1. Add the GDSDK dependency (this step requires an outbound IP address; our Android integration team will configure the whitelist). Get the IP address at: https://www.ip125.com/
  • Add the dependency in the game's main project build.gradle file:
xml
dependencies {
	...
	// This is an example. See the readme file delivered with the SDK for the specific dependency address.
    implementation 'com.gd:gdsdk-xxx:x.x.x'
	...
}

* If you receive a “403” code, your IP is not on the whitelist.

step3 Disable the APK Language Option ​

Use the android.bundle block in the game's main project build.gradle file and add language.enableSplit=false so that language files are not distributed separately when configuring the APK:

xml
android {
    bundle {
        language {
            enableSplit = false
        }
        density {
            ...
        }
        abi {
           ...
        }
    }
}