# Android Studio Remote Project + Local LLM Setup

## Project Transfer (Server → Desktop)

When the Android project lives on a remote server (e.g. Debian) and Android Studio runs locally (e.g. CachyOS):

**rsync (recommended for first-time setup):**
```bash
rsync -av --exclude='build/' --exclude='.gradle/' --exclude='.git/' --exclude='*.iml' \
  --exclude='.idea/' user@server:~/Project/ ~/Project/
```

Excludes build artifacts (~85% of size). Takes ~30-60s for a 100MB source tree.

**SSHFS (for ongoing development — no copy):**
```bash
mkdir -p ~/Project
sshfs user@server:/home/user/Project ~/Project \
  -o reconnect -o ServerAliveInterval=15 -o allow_other
```
Keep the SSHFS process running in a terminal/background. `umount ~/Project` to disconnect.

**Android Studio Remote Development (JetBrains Gateway):**
Android Studio 2025+ has built-in SSH remote development. File → Remote Development → SSH Connection → select server. The IDE runs on the server; UI renders locally.

## SDK Path Configuration

Every machine has a different Android SDK path. `local.properties` is NOT committed to git:

```properties
# Debian server:
sdk.dir=/home/user/Android

# CachyOS desktop:
sdk.dir=/home/user/Android/Sdk

# macOS:
sdk.dir=/Users/user/Library/Android/sdk
```

After transferring a project to a new machine, always fix `local.properties` first:
```bash
sed -i "s|sdk.dir=.*|sdk.dir=/home/user/Android/Sdk|g" ~/Project/local.properties
```

## Connecting Local AI Models to Android Studio

**Important:** the JetBrains marketplace has separate catalogs per IDE product. Android Studio (build AI-*)
often has fewer plugins available than IntelliJ IDEA Ultimate. Plugins found in the web marketplace may
not appear in Android Studio's in-IDE search.

### Option 1: ProxyAI Plugin (most available for Android Studio)

Plugin ID: `ee.carlrobert.chatgpt` (originally "ChatGPT", rebranded to ProxyAI).

Install: Android Studio → Settings → Plugins → Marketplace → search "ProxyAI"
Or download from `https://plugins.jetbrains.com/plugin/21056`

Configure:
- Open ProxyAI settings (Tools → ProxyAI → Settings, or right sidebar panel)
- Provider: **OpenAI Compatible** (or Custom)
- API URL: `http://192.168.1.50:9292/v1` (server LAN IP with llama-swap port)
- Model: `gemma-26b-200k` (or any model from the fleet)
- API Key: leave blank

### Option 2: CodeGPT Plugin (if available)

Install: Android Studio → Settings → Plugins → Marketplace → search "CodeGPT"
(Publisher: OBISCR — may or may not appear in Android Studio's catalog)

Configure:
- Open CodeGPT settings → Provider → **Custom OpenAI**
- API URL: `http://192.168.1.50:9292/v1`
- Model: `gemma-26b-200k`
- API Key: leave blank

### Option 3: Continue Plugin (manual install only, JetBrains version discontinued)

Continue for JetBrains was **discontinued in early 2025** and removed from the marketplace.
The JetBrains plugin is NOT available on the Android Studio marketplace. If you still want it:
1. Find an archived release from GitHub or previous download
2. Settings → Plugins → ⚙️ → Install Plugin from Disk

Config: `~/.continue/config.json`
```json
{
  "models": [
    {
      "title": "Gemma 26B",
      "provider": "openai",
      "model": "gemma-26b-200k",
      "apiBase": "http://192.168.1.50:9292/v1",
      "apiKey": "not-needed"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Gemma 12B (autocomplete)",
    "provider": "openai",
    "model": "gemma-12b",
    "apiBase": "http://192.168.1.50:9292/v1",
    "apiKey": "not-needed"
  }
}
```

### Network Requirements

- The Android Studio machine (CachyOS desktop) must be on the same LAN as the LLM server
- Use the server's **LAN IP** (e.g. `192.168.1.50`), NOT `localhost` or `127.0.0.1`
- llama-swap binds to `0.0.0.0:9292` by default (accessible from LAN)
- No authentication required for local network models
