Skip to Content
v1.29.0 · shipped Own analytics id., Refused batches are not replayed forever. Read the changelog →
QuickstartAndroid (Kotlin)

Android quickstart

dev.mushimushi:mushi-android ships shake detection (via SensorManager), a bottom-sheet capture UI, a file-backed offline queue, rage-tap and slow-screen detection, and an optional Sentry bridge.

Preview — not on Maven Central yet. A dependencies { implementation(…) } line alone will not resolve until the first release is published. Until then, build the library from the repository and consume it from your local Maven repository, as below. npx mushi-mushi does not set up native Android projects.

Build from source

The library lives in packages/android and has no Gradle wrapper checked in. CI builds it with Gradle 8.9 and JDK 17; use the same versions, plus the Android SDK.

git clone https://github.com/kensaurus/mushi-mushi.git cd mushi-mushi/packages/android gradle publishToMavenLocal

Then add mavenLocal() to your app’s repositories and depend on the version from packages/android/build.gradle.kts:

settings.gradle.kts
dependencyResolutionManagement { repositories { google() mavenCentral() mavenLocal() // preview build of dev.mushimushi:mushi-android } }
app/build.gradle.kts
dependencies { implementation("dev.mushimushi:mushi-android:0.4.0") }

CI only runs gradle assembleRelease on this module, so the local publish is the less-travelled path. If it fails for you, gradle assembleRelease builds build/outputs/aar/mushi-android-release.aar; add that file as a dependency together with the libraries it needs (androidx.core:core-ktx, androidx.appcompat:appcompat, androidx.fragment:fragment-ktx, com.squareup.okhttp3:okhttp, com.google.code.gson:gson).

Initialize

endpoint is required: use the hosted API below, or your own if you self-host.

app/src/main/java/com/example/App.kt
import android.app.Application import dev.mushimushi.sdk.Mushi import dev.mushimushi.sdk.config.MushiConfig import dev.mushimushi.sdk.config.TriggerMode class App : Application() { override fun onCreate() { super.onCreate() Mushi.init(this, MushiConfig( projectId = "YOUR_PROJECT_ID", apiKey = "mushi_...", endpoint = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api", triggerMode = TriggerMode.BOTH, // SHAKE | BUTTON | BOTH | NONE )) } }
AndroidManifest.xml
<application android:name=".App" ...> <!-- ... --> </application>

Open the widget or submit a report

The bottom sheet needs the current activity to be a FragmentActivity (for example AppCompatActivity).

// Present the bottom-sheet widget button.setOnClickListener { Mushi.showWidget() } // File a report from code, no UI Mushi.report( description = "Search results sometimes appear twice.", category = "bug", ) // Forward a caught error try { riskyOperation() } catch (t: Throwable) { Mushi.captureError(t) }

Sentry bridge (optional)

With io.sentry:sentry-android on the classpath, call MushiSentryBridge.install() (from dev.mushimushi.sdk.sentry) after initialising Sentry. It resolves Sentry by reflection and does nothing when Sentry is absent.

Full API: dev.mushimushi:mushi-android.

Last updated on