Skip to content

GetSocial Gradle Plugin Reference

Introduction

GetSocial Gradle Plugin simplifies GetSocial Android SDK integration. It adds all GetSocial dependencies to Gradle and AndroidManifest.xml modifications automatically.

Adding Plugin To Project

  1. Add repository and classpath dependency to your top-level build.gradle:

    buildscript {
        repositories {
            ...
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            ...
            classpath "im.getsocial:plugin-v7:[1,2)"
        }
    }
    
  2. In the Android application project build.gradle apply im.getsocial plugin after com.android.application:

    apply plugin: 'com.android.application'
    apply plugin: 'im.getsocial'
    
    getsocial {
        appId "put-your-getsocial-app-id-here"
        ...
    }
    

Warning

GetSocial Gradle Plugin can be used with Android Applications only.

Plugin Configuration

GetSocial Gradle Plugin exposes following DSL for configuration:

apply plugin: 'im.getsocial'

getsocial {
    version "[SDK_VERSION]" // e.g. "7.0.0"
    appId "[YOUR_APP_ID]"
    uiLibrary true
}

Where:

Property Required Default Min SDK version Description
appId + empty string 7.0.0 GetSocial App Id from the GetSocial Dashboard. More.
version - empty string 7.0.0 GetSocial SDK version to use. See available versions here. If version is not specified the latest GetSocial SDK is used.
uiLibrary - true 7.0.0 If getsocial-ui library should be added to project dependencies. More.

Available Tasks

GetSocial Gradle plugin adds a helper tasks.

Task Description
printSigningCertificateSHA256 Print SHA 265 fingerprints for all signing configurations. You’ll need signing certificate fingerprints to configure app on the GetSocial Dashboard.

Product Flavor and Build Types Support

GetSocial Gradle Plugin supports Product Flavors and Build Types.

Where to use it:

  • Testing and production versions of your application with different GetSocial appId. Keep clear your production data.

Example of build.gradle using Product Flavors or Build Types:

apply plugin: 'im.getsocial'

getsocial {
    appId "production-app-id"
    autoRegisterForPush false
}

android {
    ...
    productFlavors {
        testingApp {
            manifestPlaceholders = [
                getsocialOverrideId: "testing-app-id",
            ]
        }
        productionApp {
            // use the default configs
        }
    }
    // or if you prefer build types
    buildTypes {
        debug {
            defaultConfig {
                manifestPlaceholders = [
                    getsocialOverrideId: "testing-app-id",
                ]
            }
        }
        release {
            // use the default configs
        }
    }
}
...

If you did not specify some configuration in the flavor, project configuration is used as the fallback.

Give us your feedback! Was this article helpful?

😀 🙁