Skip to content

Hardcoded BACKEND_BASE_URL is emulator-only; should be a build property #7

Description

@dzuluaga

Problem

app/androidApp/build.gradle.kts hard-codes:
```kotlin
buildConfigField("String", "BACKEND_BASE_URL", "\"http://10.0.2.2:8000\\\"\")
```

10.0.2.2 is the Android emulator loopback to host. On a physical device it isn't routable to the dev machine. Every contributor hits this on first run.

Workaround (currently in README)

For physical device + USB:
```
adb reverse tcp:8000 tcp:8000
```
…and edit the buildConfigField to localhost:8000 before installing. Edit isn't documented.

For LAN: use host machine's LAN IP and ensure backend binds with --host 0.0.0.0 (now in README).

Proposed fix

Make it a Gradle property with a sensible default:
```kotlin
val backendUrl = (project.findProperty("backendUrl") as? String) ?: "http://10.0.2.2:8000\"
buildConfigField("String", "BACKEND_BASE_URL", "\"$backendUrl\"")
```

Then: ./gradlew installDebug -PbackendUrl=http://localhost:8000 for physical device, or -PbackendUrl=http://192.168.x.x:8000 for LAN.

Document both modes in README.

Caught by

PR #4 rebase validation — physical device couldn't reach backend until I patched this locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions