🚀 An IDE to develop real, Gradle-based Android applications on Android devices — with a powerful, multi-provider AI coding agent that understands your project, fixes your build errors, streams answers in real time, and shows you a colored
+/-diff before touching a single file.This is the piashmsu fork of AndroidCodeStudio, heavily extended by Shorif uddin with: 7+ AI providers, build-error auto-fix, streaming responses, diff preview, editor AI actions, voice + image input, sticky-provider auto-fallback, and dozens of bug fixes & optimisations.
Active branch:
devin/1777186665-ai-agent-openrouter-autofix— open PR: #1
| Provider | Status | Notes |
|---|---|---|
| OpenRouter | New | 21+ curated free + paid models, custom vendor/model slug supported, fallback chain |
| OpenAI-compatible (custom URL) | New | Manually configure Base URL + API key + Model id. Works with Together, Groq, DeepInfra, Fireworks, Ollama (http://10.0.2.2:11434/v1), self-hosted vLLM, anything that speaks /v1/chat/completions |
| OpenAI | Existing | Bug-fixed (was sharing DeepSeek strings) |
| Anthropic Claude | Existing | Bug-fixed |
| Google Gemini | Existing | — |
| DeepSeek | Existing | — |
| xAI Grok | Existing | Bug-fixed |
| Local LLM | Existing | Improved integration |
| Capability | Status |
|---|---|
| Token-by-token streaming response (SSE) | New |
| Build-error auto-fix dialog | New |
| Live progress dialog with streamed AI reply, file list, activity log, error excerpt | New |
| Auto-rebuild after AI fix (max 3 cycles) | New |
| Diff preview before applying file changes (line-level, optional) | New |
| Editor selection actions: Explain / Refactor / Add docs / Generate test | New |
Project memory (.aistudio/memory.md) |
New |
| Quick-start templates: Calculator, Todo, Chat, Login | New |
| Markdown rendering for AI replies (code blocks, bold, lists, headings) | New |
| Token counter (per request + session total) | New |
| Conversation export (markdown + JSON) | New |
| OpenRouter fallback chain (free → free → free) | New |
| Crash → AI auto-prefill on next launch | New |
@filename mentions in chat auto-attach file contents |
New |
| Voice input (Bengali + English, device speech recognizer) | New |
| Provider-preset picker (Together / Groq / DeepInfra / Fireworks / Anyscale / Mistral / Perplexity / OpenAI / OpenRouter / Ollama / vLLM) | New |
| Auto-detect local Ollama | New |
| Settings JSON export / import | New |
| Offline indicator (skip 30 s watchdog when no network) | New |
| Sensitive-data detection in outgoing prompts | New |
ai_backups/ retention (30 days / 200 files max) |
New |
| Planning mode (think-then-plan-then-code) toggle | New |
| Markdown pipe-table rendering in AI replies | New |
| Image input (vision models, gallery picker, base64 multimodal) | New |
| Inline ghost text (Copilot-style) | Planned |
| Multi-file smart context picker | Planned |
| Tool calling / function calling | Planned |
When a Gradle build fails:
- The IDE captures full Gradle output, the failing task name, and the error tail.
- A confirmation dialog asks if you want the AI to fix it.
- Tapping Fix opens a live progress dialog (85% screen height, scrollable):
- Header card — spinner, status text, attempt chip (e.g.
Attempt 2/3) - Build error excerpt — extracts Kotlin
e: ...anderror: ...lines first, filters Gradle deprecation/help noise, deduped, max 12 lines - Files being modified — RecyclerView with success/fail icons, count badge
- AI reply card — markdown-rendered streaming text (80 ms throttling, smooth)
- Activity log — color-coded (info / file / success / warn / error) with timestamps
- Header card — spinner, status text, attempt chip (e.g.
- After AI replies, files are written to disk via
AIFileWriter(with timestamped backup inapp's filesDir/ai_backups/). - If
Auto-rebuild after AI fixis enabled, the build is re-run automatically (up to 3 cycles). - Cancel button aborts a running request. 30-second watchdog logs an actionable warning if no progress arrives (likely invalid API key, dead model, or unreachable provider).
- Provider/model badge is shown on the dialog so you always know which upstream is being hit.
- Provider dropdown — pick from 7+ providers
- Model / Agent box — fully editable; type any model id (e.g.
deepseek/deepseek-chat-v3.1:free), tap Done, it persists - API key dialogs — per provider
- OpenAI-compatible group — Base URL + API key + Model id, with
Save endpointbutton and URL normalization (/v1,/v1/chat/completions, or just domain — all work)- Use a preset — one-tap URL fill for Together / Groq / DeepInfra / Fireworks / Anyscale / Mistral / Perplexity / OpenAI / OpenRouter / Ollama (emulator + LAN) / vLLM
- Auto-detect local Ollama — probes
10.0.2.2:11434,localhost:11434, LAN; on hit fills URL and lists installed models
- Custom OpenRouter model — saved name appears in the main Model/Agent box and survives app restart
- Streaming responses toggle (default ON)
- Diff preview before applying toggle (default OFF)
- Auto-rebuild after AI fix toggle (default OFF)
- Auto-switch on quota/rate-limit toggle (within-provider only by default)
- Allow cross-provider fallback toggle — default OFF. ON re-enables automatic switching from (e.g.) OpenRouter to OpenAI-compat on quota/rate-limit errors. OFF keeps you on the provider you picked and lets you fix it (add credits, change model, etc.).
- Code completion toggle
- Planning mode toggle — asks the model to emit a short plan before any code
- Export / Import settings — JSON file in
Downloads/AndroidCodeStudio/, preserves all provider keys, base URLs, model ids, and toggles (schema-versioned)
- Voice input — mic button next to Clear. Uses the device's speech recognizer (Bengali + English on most phones). Recognised text is appended to whatever you've already typed.
- 🖼 Image input (vision models) — image button next to the mic. Pick a photo / screenshot from the gallery; it is downscaled to ≤ 1600 px on the longest edge, JPEG-compressed (q=85, recompressed harder if still > 4 MB), and base64-attached to the next message as a multimodal
image_urlcontent part. Works with every modern vision model on OpenRouter (gpt-4o,gemini-*,claude-3.5,llama-3.2-*-vision,qwen-2-vl, …) and any OpenAI-compatible vision endpoint. A live chip below the prompt shows the attachment and lets you remove it with a tap. @filename.ktmentions — type@MainActivity.ktin your prompt; the IDE scans the open project, prepends the matched file(s) to the prompt as explicit context (max 8 files × 32 KB), and still passes your original intent through so the model sees both.- Offline guard — if the device has no validated internet, the request returns immediately with a clear message instead of waiting 30 seconds.
- Sensitive-data warning — if your prompt contains what looks like a real API key / token / private-key block, a warning is shown before sending.
gradle.properties is auto-tuned for new projects via the included project template + GradlePropertiesPresets:
- Gradle daemon ON
- Parallel builds ON
- Build cache ON
- Configuration cache ON
- JVM heap 4 GB +
UseParallelGC - Kotlin incremental compile ON
- AAPT2 daemon + parallel resource processing
Expected impact: clean build 4–5 min → 1–2 min, incremental rebuild 30–60 s → 5–15 s.
- Conversation history capped at 20 messages for every provider
- File-context loading capped at 40 files × 64 KB to avoid OOM on large projects
- Replaced 100 ms
SharedPreferencespolling loop withOnSharedPreferenceChangeListener(battery + CPU savings) - Live progress dialog uses 80 ms coalesced UI updates for streaming (no UI jank)
- OpenAI / Anthropic / Grok strings were copy-pasted from DeepSeek (every label said "Deepseek"). Fixed.
- 51 duplicate string IDs in Arabic
strings.xml. Fixed. - Duplicate
title_build_variantsresource. Fixed. - Format string mismatches in Arabic + Chinese translations. Fixed (positional format).
- AAPT2 errors during release build. Fixed.
jdk-compilermodule had references to missing OpenJDK source files (ServerMain,SjavacServer, etc). Excluded from build.ClangLanguageServerstub added (file was gitignored upstream).- OpenRouter custom model field couldn't be typed into (
inputType="none"). Now editable. - Custom OpenRouter model name didn't persist visually in the main Model/Agent box. Fixed — typed name is added to the dropdown list, persists across app restarts, and is restored from preferences.
- Chat tab Send button was off-screen on narrow phones (Export + Clear were eating row width). Fixed — Export and Clear are now icon-only, Send is anchored full-width.
- Various AI agent message-routing bugs around streaming and modification callbacks.
- Provider switch was leaving stale model ids attached (e.g. picking OpenAI-compat while an OpenRouter
vendor/modelslug was still active made the upstream 400).AIPreferencesFragment.handleProviderChangenow persists the provider before callingsetAgent, and restores the saved OpenAI-compat model id on switch. AIAgentManagerhardcodedsetProvider("gemini")on init, so auto-fix ignored the user's saved preference even though chat honoured it. It now readsAgents.getProvider().BuildErrorAutoFixeralso force-sets the saved provider before hitting the upstream, regardless of what the fallback chain selected.- Error bubbles were inlining 500-character stack traces. They are now short ("provider / type / message"); the full trace stays in logcat.
- Model dropdown could show the same id twice when the user typed a model that was already part of the curated list — deduped.
- Preferences changes (API key, base URL, model) used to require an app restart to take effect.
AIAgentManagernow registers aSharedPreferences.OnSharedPreferenceChangeListenerthat re-initialises the active agent as soon as anythingai_agent_*/ai_provider*changes. - Live-progress
Cancelbutton used to leave the dialog open — user had to tap OK separately. It now auto-dismisses 1.2 s after cancellation. - Auto-switch on errors used to silently jump to a different provider (e.g. OpenRouter → OpenAI-compat) when the upstream returned 400 about token-overflow. Now: a new
ContextTooLongExceptiondistinguishes "prompt > model context window" from real account-level quota errors. On context-overflow, the agent cycles through OpenRouter's large-context models (Gemini Flash 2.0 ~1M, Gemini 1.5 ~1M, Llama 3.3 70B 128k, Llama 3.1 70B 128k, Qwen-2.5-Coder 128k, DeepSeek v3.1 64k+) on the same provider — no provider hop. Cross-provider fallback for other error types is now gated behind an explicit user toggle (default OFF).
- Gradle support
- JDK 11 & JDK 17 available
- Terminal with essential packages
- Custom environment variables (for builds & terminal)
- SDK & NDK Manager (manage Android SDKs and NDKs via terminal)
- API information for classes and their members (since, removed, deprecated)
- Log reader (real-time logs for your app)
- Language servers
- Java
- XML
- Kotlin
- UI Designer
- Layout inflater
- Resolve resource references
- Auto-complete resource values when editing attributes
- Drag & Drop interface
- Visual attribute editor
- Android Widgets
- String Translator
- Asset Studio (Drawable & Icon Maker)
- Plugin Creator (Create sub-modules or plugins inside your project)
- Git integration
- AI Agent – fully project-aware AI assistant with multi-provider support, streaming, diff preview, build-error auto-fix, editor selection actions, and project memory.
Please install Android Code Studio from trusted sources only:
- Download the APK from a trusted source.
- Follow the setup guide to install build tools.
git clone https://github.com/piashmsu/android-code-studio.git
cd android-code-studio
git checkout devin/1777186665-ai-agent-openrouter-autofix
# Provide SDK location:
echo "sdk.dir=/path/to/your/android-sdk" > local.properties
# Debug APK (split per ABI):
./gradlew :core:app:assembleDebug
# Output:
ls core/app/build/outputs/apk/debug/
# android-code-studio-arm64-v8a-debug-*.apk
# android-code-studio-armeabi-v7a-debug-*.apk- Project must use Android Gradle Plugin v7.2.0 or newer.
- SDK Manager is bundled and accessible from the terminal, but some tools (like NDK) are not built for Android.
The app is in active development. Please report issues you encounter.
See the contributing guide.
For translations, visit the Crowdin project page.
- Rosemoe for the awesome CodeEditor
- Termux for the Terminal Emulator
- Bogdan Melnychuk for AndroidTreeView
- George Fraser for the Java Language Server
- FWCD for the Kotlin Language Server
- Itsaky — original developer of AndroidIDE
- Mohammed-baqer-null — maintainer of the AndroidCodeStudio upstream this fork is based on.
Thanks to all the developers who have contributed to this project.
- Telegram: t.me/rv2ide
- Upstream docs: m.androidide.com
Architect of this fork — every AI feature, every bug fix, every animation on this README.
If this project helped you, drop a ⭐ on the repo — it tells Shorif uddin to keep shipping.
AndroidCodeStudio is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AndroidCodeStudio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AndroidCodeStudio. If not, see <https://www.gnu.org/licenses/>.
Any violations of the license can be reported either by opening an issue or writing a mail to us directly.

