Gradle Setup for Android
Setup
Before getting Cloud-Inject SDK, you need to setup the Gradle repository to use.
Cloud-Inject is directly available in Maven Central
. You don't need anything to do apart using mavenCentral()
Cloud-Inject SDK
Dependency
In your app build.gradle
file, add a new dependency:
// CloudInject SDK
implementation("io.kotzilla:cloud-inject:$version")
Cloud-Inject Gradle Plugin
Groovy
In your root, build.gradle declare Kotzilla maven repository:
buildscript {
dependencies {
classpath "io.kotzilla:cloud-inject-gradle:<version>"
}
}
And then apply the plugin in your module:
apply plugin: 'cloud-inject'
Kotlin KTS
In your root, build.gradle.kts declare the Kotzilla repository:
buildscript {
dependencies {
classpath("io.kotzilla:cloud-inject-gradle:<version>")
}
}
And then apply the Gradle plugin in your project module:
plugins {
id("io.kotzilla.cloud-inject")
}
// or
apply(plugin = "cloud-inject")
Plugin Settings
If you need to configure manually a versionName
(in case of Android Library project), you need to setup a plugin section like this:
configure<io.kotzilla.gradle.ext.CloudInjectExtension> {
// Android Library version
versionName = "1.0.0"
}
Pro Guard Rules
By using proguard you need to exclude some package for the Kotzilla SDK:
- io.kotzilla.json
- io.kotzilla.cloudinject
Declare it in you proguard file:
-keep class io.kotzilla.json.** { *; }
-keep class io.kotzilla.cloudinject.** { *; }
Also, if needed be sure to keep classes for ktor & kotlin:
-keepclassmembers class kotlinx.** { volatile <fields>; }
-keepclassmembers class io.ktor.** { volatile <fields>; }