Android Development with Cursor: Setup and Tips

Android development has traditionally been tied to Android Studio, Google's official IDE built on IntelliJ IDEA. Cursor, being a VS Code fork with AI capabilities, offers a different experience -- one that trades some Android-specific tooling for powerful AI assistance. This guide explains how to set up Cursor for Android development, when it makes sense to use it, and where Android Studio remains essential.
Android Studio vs Cursor: What You Gain and Lose
Before switching to Cursor for Android work, understand the tradeoffs:
| Feature | Android Studio | Cursor |
|---|---|---|
| Layout Editor (XML visual) | Yes | No |
| Emulator integration | Built-in | External |
| Gradle sync & build | Native | Terminal only |
| Logcat viewer | Built-in | No |
| APK analyzer | Built-in | No |
| Database inspector | Built-in | No |
| AI code assistance | Basic (Gemini) | Advanced (Claude, GPT) |
| Natural language chat | No | Yes |
| Composer multi-file edits | No | Yes |
| VS Code extensions | No | Yes |
| Customizable keybindings | Limited | Full |
The decision is not binary. Many developers use Cursor for writing code and Android Studio for building, debugging, and running the emulator.
Setting Up Cursor for Android Development
1. Install Required Extensions
Cursor supports VS Code extensions. For Android development, install these:
- Open Cursor
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for and install:
- Kotlin Language by
mathiasfrohlich-- syntax highlighting and basic IntelliSense - Kotlin by
fwcd-- advanced Kotlin support (choose one) - Android iOS Emulator by
DiemasMichiels-- launcher for emulators - Gradle Language Support -- for
build.gradleandsettings.gradlefiles - XML Tools -- for Android manifest and layout files
- Kotlin Language by
// Recommended extensions in .vscode/extensions.json
{
"recommendations": [
"mathiasfrohlich.kotlin",
"vscjava.vscode-gradle",
"redhat.vscode-xml",
"diemasmichiels.emulator"
]
}
2. Open Your Android Project
You can open an Android project in Cursor just like any other folder:
# Navigate to your project
cd ~/Projects/MyAndroidApp
# Open in Cursor
cursor .
Cursor can edit .gradle and .kts files, but it cannot sync Gradle or resolve dependencies the way Android Studio does. You will run Gradle commands from the terminal.
3. Configure Gradle Build Tasks
Set up VS Code tasks for common Gradle operations:
// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Debug APK",
"type": "shell",
"command": "./gradlew",
"args": ["assembleDebug"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Run Tests",
"type": "shell",
"command": "./gradlew",
"args": ["test"]
},
{
"label": "Install Debug APK",
"type": "shell",
"command": "./gradlew",
"args": ["installDebug"]
},
{
"label": "Clean Build",
"type": "shell",
"command": "./gradlew",
"args": ["clean"]
}
]
}
Run tasks with Ctrl+Shift+B (Cmd+Shift+B on macOS).
Gradle Setup in Cursor
Gradle is the backbone of Android builds. In Android Studio, Gradle sync happens automatically. In Cursor, you manage it manually.
Common Gradle Commands
# Build the project
./gradlew build
# Build debug APK
./gradlew assembleDebug
# Build release APK
./gradlew assembleRelease
# Run unit tests
./gradlew test
# Run instrumented tests
./gradlew connectedAndroidTest
# Clean build artifacts
./gradlew clean
# View all available tasks
./gradlew tasks
Gradle Wrapper Issues
If the wrapper script is not executable:
chmod +x gradlew
On Windows, use gradlew.bat instead of ./gradlew.
Dependency Management
When you add a dependency to build.gradle or build.gradle.kts, Cursor will not auto-sync. You must run:
./gradlew build
Or use the Gradle daemon for faster subsequent builds:
./gradlew --daemon build
The Gradle daemon stays resident in memory and speeds up builds significantly. Enable it by default by creating a gradle.properties file in ~/.gradle/ with org.gradle.daemon=true.
Emulator Integration
Cursor does not have a built-in emulator like Android Studio. You have two options:
Option 1: Launch Emulator from Terminal
# List available emulators
emulator -list-avds
# Launch a specific emulator
emulator -avd Pixel_7_API_34
Add this as a VS Code task for quick access:
{
"label": "Launch Emulator",
"type": "shell",
"command": "emulator",
"args": ["-avd", "Pixel_7_API_34"]
}
Option 2: Use the Emulator Extension
The Android iOS Emulator extension by DiemasMichiels adds an emulator launcher to Cursor's status bar.
- Install the extension
- Click the emulator icon in the status bar
- Select your AVD from the dropdown
Option 3: Keep Android Studio Open
Many developers simply keep Android Studio running for the emulator and Logcat, while editing code in Cursor. This is the most reliable approach.
Kotlin and Java Support
Cursor handles both Kotlin and Java well, but Kotlin support is stronger due to community tooling.
Kotlin
- Syntax highlighting works with the Kotlin extension
- Cursor Tab autocomplete is effective for Kotlin idioms
- AI chat understands Kotlin coroutines, Flow, and Compose
Example prompt for Kotlin:
"Create a ViewModel in Kotlin that fetches user data using
Retrofit and exposes it as StateFlow. Handle loading and error states."
Java
- Java support in Cursor is excellent (VS Code has mature Java extensions)
- You can install the Extension Pack for Java by Microsoft for full IDE features
- Cursor's AI works equally well with Java and Kotlin
// For full Java support
{
"recommendations": [
"vscjava.vscode-java-pack"
]
}
Android Jetpack Compose
Jetpack Compose is where Cursor shines. Since Compose is code-only (no XML layouts), the entire UI can be written and refined in Cursor:
@Composable
fun UserProfileCard(user: User) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
) {
Column(modifier = Modifier.padding(16.dp)) {
Text(text = user.name, style = MaterialTheme.typography.headlineSmall)
Text(text = user.email, style = MaterialTheme.typography.bodyMedium)
}
}
}
Cursor can generate, refactor, and explain Compose code effectively because it is pure Kotlin.
The Dual-IDE Workflow
Based on community feedback, the most productive setup for Android development is:
| Task | Tool | Reason |
|---|---|---|
| Write Kotlin/Java code | Cursor | AI assistance, better editing |
| Edit XML layouts | Either | Cursor works; Android Studio has preview |
| Build and deploy | Android Studio | Reliable Gradle sync and emulator |
| Debugging with breakpoints | Android Studio | Superior debugger and Logcat |
| Compose UI development | Cursor | Code-only, no preview needed |
| Profiling and analysis | Android Studio | CPU/memory/network profilers |
Recommended Workflow
- Open the project in both IDEs
- Edit code in Cursor -- use chat for explanations, Composer for refactors
- Build in Android Studio -- click the run button for emulator deployment
- Debug in Android Studio -- use Logcat and the debugger
- Commit from either -- both IDEs detect file changes via the filesystem
Limitations
What Cursor Cannot Do for Android
| Limitation | Impact | Workaround |
|---|---|---|
| No Layout Editor | Cannot visually edit XML | Edit XML manually or use Android Studio |
| No built-in emulator | Cannot run apps directly | Use terminal or keep Android Studio open |
| No Logcat viewer | Cannot view logs | Use adb logcat in terminal or Android Studio |
| No APK analyzer | Cannot inspect APKs | Use Android Studio's Build Analyzer |
| No database inspector | Cannot inspect Room databases | Use Android Studio or Stetho |
| Gradle sync not automatic | Must manually run builds | Use terminal or task shortcuts |
Known Issues
Issue: Kotlin extension shows errors for valid code
Solution: The Kotlin extension for VS Code is not as mature as Android Studio's. Some errors are false positives. Rely on Gradle builds for the real compilation status.
Issue: Compose preview does not work
Solution: Android Studio's Compose preview is not available in Cursor. Use the emulator or build the app to see UI changes.
Issue: R.java references show as unresolved
Solution: Run ./gradlew build once so that generated code is created. The Kotlin extension may still show warnings, but the code compiles.
Best Practices
1. Use Compose When Possible
Jetpack Compose eliminates the need for XML layout editing, making Cursor a much more viable primary editor for Android UI work.
2. Create Shell Scripts for Common Tasks
Automate repetitive Gradle commands:
#!/bin/bash
# scripts/build.sh
./gradlew clean assembleDebug && adb install app/build/outputs/apk/debug/app-debug.apk
3. Use ADB from Terminal
Learn ADB commands for quick device interactions:
# Install APK
adb install app/build/outputs/apk/debug/app-debug.apk
# View logs for your app
adb logcat -s "MyAppTag:D"
# Clear app data
adb shell pm clear com.example.myapp
# Screenshot
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
4. Leverage Cursor's AI for Boilerplate
Android involves significant boilerplate. Use Cursor to generate:
- RecyclerView adapters
- Retrofit service interfaces
- Room database entities and DAOs
- ViewModel factories
- Dagger/Hilt modules
Cursor prompt:
"Generate a Room database entity for a Todo item with id, title,
description, dueDate, and isCompleted fields. Include the DAO with
CRUD operations and a query to get completed todos."
Summary
Cursor is a viable tool for Android development, especially for Kotlin and Jetpack Compose projects. It is not a full replacement for Android Studio, but it excels at code writing, refactoring, and AI-assisted development.
Key takeaways:
- Install Kotlin and Gradle extensions for basic IDE features in Cursor
- Use Gradle commands from the terminal -- there is no automatic sync
- Launch the emulator from terminal or use the Emulator extension
- The dual-IDE workflow (Cursor for code, Android Studio for build/debug) is most reliable
- Jetpack Compose projects work best in Cursor because they are code-only
- Always verify builds in Android Studio before releasing
If your workflow is heavily dependent on visual layout editing, extensive debugging, or profiling, Android Studio remains essential. For pure code writing with AI assistance, Cursor is a strong alternative.
Last updated: June 2025