Be up and running in under 5 minutes
Add the SDK to your project
Add the Codeskop Android SDK to your app module's
build.gradlefile.app/build.gradle.ktsdependencies { implementation("com.codeskop.sdk:tracker-android:0.3.0") // Optional: OkHttp / Retrofit network capture (recommended) implementation("com.codeskop.sdk:tracker-okhttp:0.3.0")}app/build.gradledependencies { implementation 'com.codeskop.sdk:tracker-android:0.3.0' // Optional: OkHttp / Retrofit network capture (recommended) implementation 'com.codeskop.sdk:tracker-okhttp:0.3.0'}Latest version: 0.3.0
Artifacts are on Maven Central, which every Android project already includes, so no extra repository is needed. Check the release notes for updates. RequiresminSdk 24or higher.Initialize Codeskop
Give the SDK your public ingest key. Pick one of the two options; both do the same thing.
Option A: zero code. Add your key to
AndroidManifest.xml. The SDK starts itself through App Startup, off the main thread, beforeApplication.onCreateruns.AndroidManifest.xml<application ...> <meta-data android:name="codeskop.api_key" android:value="cs_live_pk_YOUR_KEY" /></application>Option B: in code. Use this when you need runtime configuration, such as a different key per build type.
MyApplication.ktclass MyApplication : Application() { override fun onCreate() { super.onCreate() CodeskopAndroid.init( this, CodeskopConfig(apiKey = BuildConfig.CODESKOP_KEY), ) }}Get your ingest key
Create a project in the Codeskop dashboard and copy its public key. It starts withcs_live_pk_(orcs_test_pk_for testing). Public keys can only write events, so they're safe to ship in your app. Never put a secret key (cs_…_sk_) in an app.That's all that's needed for crash and ANR capture; both are on from the moment the SDK starts.
Identify your users
Optional, but recommended: see which users an issue affects.
Kotlin// After a successful login or sign-up, use your own stable user id, never an emailCodeskop.identify(userId = user.id, traits = mapOf("plan" to user.plan)) // On logoutCodeskop.reset()Pass an ID from your own system. Codeskop never needs an email address or name. See Identify users.
Capture network failures
Optional: add the OkHttp adapter to see failing requests, status codes and latency.
NetworkModule.ktimport com.codeskop.sdk.okhttp.codeskop val client = OkHttpClient.Builder() .codeskop() // failed requests + timing, one line .build() // Retrofit picks it up automaticallyval retrofit = Retrofit.Builder() .client(client) .baseUrl("https://api.example.com/") .build()No per-endpoint setup. Headers such as
AuthorizationandCookieare redacted before anything leaves the device. More in Network capture.Verify installation
Run your app, then send a test event to confirm everything is connected.
Kotlin// Anywhere in a debug build: records a handled exception, then sends it right awayCodeskop.recordException(IllegalStateException("Codeskop test event"))lifecycleScope.launch { Codeskop.flush() }flush()asks the SDK to send its queue now; normally it syncs on its own in the background. Open your project in the dashboard to see the event. Events are stored on the device first, so a test run in airplane mode still shows up once the device reconnects.Nothing showing up?
Check that the key is a publicpkkey and that your plan is active. The troubleshooting guide walks through every common cause.