Technology May 01, 2026 · 2 min read

I Added Gemini AI to My Android Logcat Viewer. One Click Diagnoses the Error.

All tests run on an 8-year-old MacBook Air. Android Studio's logcat is fine. But opening a full IDE just to read logs and debug an error felt like overkill. I built a lightweight logcat viewer in Rust + Tauri. Then I added a Gemini button next to every error line. One click — AI diagnosis, no copy...

DE
DEV Community
by hiyoyo
I Added Gemini AI to My Android Logcat Viewer. One Click Diagnoses the Error.

All tests run on an 8-year-old MacBook Air.

Android Studio's logcat is fine. But opening a full IDE just to read logs and debug an error felt like overkill.

I built a lightweight logcat viewer in Rust + Tauri. Then I added a Gemini button next to every error line. One click — AI diagnosis, no copy-pasting, no context switching.

Here's how the AI integration works.

The idea: click the error, get the diagnosis

Every error line in the viewer has a small button. Click it, and the app:

  1. Pulls that error line plus the surrounding 50–100 lines from a ring buffer
  2. Strips any PII (IP addresses, emails) before sending
  3. Sends the context to Gemini with a carefully crafted prompt
  4. Displays the diagnosis in an overlay panel

No manual copy-pasting. No switching to a browser. The diagnosis appears where the error is.

The ring buffer design

Logcat streams thousands of lines per minute. You can't keep all of them in memory.

The Rust backend maintains a ring buffer of the last 2,000 lines. When the user clicks diagnose, slicing out the relevant context is instant:

pub struct LogRingBuffer {
    lines: VecDeque,
    capacity: usize,
}

impl LogRingBuffer {
    pub fn push(&mut self, line: LogLine) {
        if self.lines.len() >= self.capacity {
            self.lines.pop_front();
        }
        self.lines.push_back(line);
    }

    pub fn context_around(&self, target_idx: usize, window: usize) -> Vec<&LogLine> {
        let start = target_idx.saturating_sub(window);
        let end = (target_idx + window).min(self.lines.len());
        self.lines.range(start..end).collect()
    }
}

2,000 lines, instant slice, minimal memory.

The prompt

let system = "You are an Android development specialist. \
    Analyze the following logcat output and explain \
    the root cause and fix concisely.";

let context_text = context_lines
    .iter()
    .map(|l| l.raw.as_str())
    .collect::>()
    .join("\n");

let prompt = format!("{}\n\nLogcat:\n{}", system, context_text);

Simple. The context does the heavy lifting — Gemini doesn't need elaborate prompting when the relevant lines are right there.

Result

Open the viewer, run the app, see an error → click the button → diagnosis in 2–3 seconds. No IDE required.

HiyokoLogcat is free and open source → github.com/hiyoyok/HiyokoLogcat
X → @hiyoyok

DE
Source

This article was originally published by DEV Community and written by hiyoyo.

Read original article on DEV Community
Back to Discover

Reading List