Skip to content
Codeskop

Quick Start for Android

Get Codeskop up and running in minutes and start seeing real issues from your Android users.

Be up and running in under 5 minutes

Add the Codeskop Android SDK, initialize it with your ingest key, and start seeing crashes, ANRs and network issues from real users.
  1. Add the SDK to your project

    Add the Codeskop Android SDK to your app module's build.gradle file.

    app/build.gradle.kts
    dependencies {    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. Requires minSdk 24 or higher.
  2. 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, before Application.onCreate runs.

    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.kt
    class 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 with cs_live_pk_ (or cs_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.

  3. 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.

  4. Capture network failures

    Optional: add the OkHttp adapter to see failing requests, status codes and latency.

    NetworkModule.kt
    import 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 Authorization and Cookie are redacted before anything leaves the device. More in Network capture.

  5. 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 public pk key and that your plan is active. The troubleshooting guide walks through every common cause.

Next steps