Skip to main content

Setup for Android Application

note

You need to have a Kotzilla account and having registered your application on the platform. See Signup Page

Gradle Setup

note

Kotzilla SDK is available on Maven Central and Kotzilla repository.

In your app module, add the plugin and Kotzilla SDK dependency to the build.gradle.kts file within the module directory: Module (app-level) Gradle file (<project>/<app-module>/build.gradle.kts):

Gradle Plugin & Dependencies

plugins {

// Kotzilla Gradle plugin
id("io.kotzilla.kotzilla-plugin") version "<version>" apply false
}

dependencies {
// The Kotzilla SDK library dependency
implementation("io.kotzilla:kotzilla-sdk:<version>")
}

Get your Kotzilla Project file

From the Platform onboarding, or from your application settings page, you can download your kotzilla.json file and put it at your Gradle file project folder (<project>/<app-module>).

The Kotzilla Plugin will generate a secured key container in your Android assets folder.

info

The Kotzilla plugin will help to generate secured API key. You can overload this key with KOTZILLA_API_KEY environment variable.

See more about Kotzilla Project File.

Starting the SDK with Koin

In your Android app Application class, you need to activate the Kotzilla platform with:

  • KotzillaSDK.setup(this)- to start the Kotzilla SDK
  • From Koin configuration, use analyticsLogger() to activate analytics
class MainApplication : Application() {

override fun onCreate() {
super.onCreate()

// Start Kotzilla SDK
KotzillaSDK.setup(this)

// Start Koin
startKoin {
// replace your logger with Kotzilla Analytics
analyticsLogger()

// Your Koin config here
}
}
}

Pro Guard Rules

By using proguard you need to exclude some package for the Kotzilla SDK:

- io.kotzilla.json
// 0.12.0
- io.kotzilla.cloudinject
// 0.13.0
- io.kotzilla.sdk

Declare it in you proguard file:

-keep class io.kotzilla.json.** { *; }
-keep class io.kotzilla.data.json.** { *; }
-keep class io.kotzilla.sdk.** { *; }

Also, if needed be sure to keep classes for ktor & kotlin:

-keepclassmembers class kotlinx.** { volatile <fields>; }
-keepclassmembers class io.ktor.** { volatile <fields>; }