Add Crash Reporting to a Java Android App with AppAmbit
Watch this step-by-step tutorial to add crash reporting to a Java Android app with AppAmbit. Install the SDK via Gradle from Maven Central, connect your app with an App Key, trigger a real crash, and inspect the full report — stack trace, affected users, device, and session data — in the dashboard. Complete Java integration in under ten minutes.
Watch the full tutorial or read the summary below
Overview
In this tutorial, we'll add crash reporting to a Java Android app with AppAmbit. We'll install the SDK via Gradle, connect the app with an App Key, and trigger a real crash. Then we'll verify the report in the dashboard and inspect the crash details. By the end, you'll have the complete flow working in under ten minutes.
What You'll Learn
- How to add the AppAmbit SDK to a Java Android project via Gradle
- Connecting an Android app with your App Key
- Initializing AppAmbit in
MainActivity - Triggering a real, uncaught crash for testing
- Verifying the crash report in the dashboard
- Inspecting stack traces, affected users, and device details
Prerequisites
Before you begin, make sure you have:
- A Java Android app project open in Android Studio
- An AppAmbit account (sign up for free)
- Your app's unique App Key from the dashboard
Confirm the App Builds
Start with a plain Android Studio project — a single MainActivity extending AppCompatActivity, showing "Hello World". Run it once on an emulator before touching AppAmbit to confirm it builds and launches cleanly. Keeping the starting point simple makes the integration easy to follow.
Copy Your App Key
In AppAmbit, open the Android application you want to monitor. From the Info page, copy its App Key. This key links the SDK to the correct app — keep it private.
Add the AppAmbit Dependency
The Audience tab shows a Quick Setup Guide the moment an app has no data yet. Open the module-level build.gradle (or build.gradle.kts) and add the dependency inside the dependencies block:
dependencies {
implementation("com.appambit:appambit:1.0.2")
}
The SDK is available from Maven Central (recommended — easiest to keep up to date) or as a direct download from Releases if you'd rather pin a specific artifact manually.
Sync Gradle
Sync the project. Gradle resolves the dependency and adds it to the project — confirm AppAmbit appears under External Libraries in the project view before moving on.
Initialize AppAmbit
Open MainActivity, import AppAmbit at the top of the file, and call AppAmbit.start inside onCreate — before setContentView — passing the application context and the App Key you copied from the dashboard.
import com.appambit.sdk.AppAmbit;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppAmbit.start(getApplicationContext(), "YOUR-APPKEY");
setContentView(R.layout.activity_main);
}
}
Run the application again. It launches normally, and AppAmbit starts the first session — the dashboard now reflects that the integration is active.
Trigger a Test Crash
Add a temporary button to activity_main.xml:
<Button
android:id="@+id/btnThrowNewCrash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Throw Crash" />
Then wire it up in MainActivity to throw an uncaught exception:
Button btnThrowNewCrash = findViewById(R.id.btnThrowNewCrash);
btnThrowNewCrash.setOnClickListener(v -> {
Crashes.generateTestCrash();
});
This code is for testing only. Remove it before release.
Tap Throw Crash. The app terminates, and the emulator returns Home. Reopen the app — this step is required for the report to be sent.
Verify the Crash Report
After the app launches again, return to the AppAmbit dashboard and open Diagnostics. The report may take a few seconds to arrive — refresh the page if necessary. Once processed, the crash appears in the chart and diagnostics list.
Open the new crash to inspect its details. At the top, AppAmbit shows unique users, app versions, occurrences, and last seen time. The message identifies the failing class, while the stack trace points to the exact line in MainActivity that threw. Further down, review the device, OS, and app version in the device table, plus By OS and By Device charts — with a link straight into the session that produced the crash.
Next Steps
After completing this tutorial, check out:
Frequently Asked Questions
Q Which Android setup does this tutorial use?
A plain Java Android app in Android Studio, with the SDK added via Gradle from Maven Central. The same flow applies to Kotlin projects — AppAmbit's setup guide covers both Kotlin DSL and Groovy for Gradle, and the SDK's initialization call works the same way in Kotlin syntax.
Q Why do I have to reopen the app after the crash?
Crash reports are captured when the app terminates and sent on the next launch. Reopening the application is what delivers the report to AppAmbit, so this step is required before the crash appears in the dashboard.
Q Where does the crash report show up?
In the AppAmbit dashboard under Diagnostics. Once processed, the crash appears in the chart and the diagnostics list. Open it to see unique users, app versions, occurrences, last seen time, the failing class, and the full stack trace.
Q What details does a crash report include?
The top of the report shows unique users, app versions, occurrences, and last seen time, followed by the message and stack trace pointing at the exact failing line. Below that is a device table with OS and app version, plus charts comparing crashes by OS and by device.
Q Is it safe to leave the test crash button in my app?
No. The test button and the NullPointerException it throws are for verifying your integration only. Remove them before you ship — never release intentional crash code to production.
Q Do you offer a free account?
Yes — AppAmbit offers a free account with everything you need to get started. You can create apps, track crashes, send analytics, view logs, and upload builds. You only pay if your usage grows beyond the free tier limits.
Q How do I get support or migration help?
The AppAmbit team is available to help you set up crash reporting or migrate an existing project.
Ready to get started with AppAmbit?
Monitor your mobile apps with real-time crash reporting, analytics, and app distribution.
Start Free Trial