La Previa Restobar ships three build types —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luisumit/LaPreviaRestobar/llms.txt
Use this file to discover all available pages before exploring further.
debug, staging, and release — each targeting a different backend environment. Rather than switching URLs at runtime through a shared configuration file, every endpoint is baked into a generated BuildConfig class at compile time, so there is no risk of a debug build accidentally hitting the production API. The sections below explain each variant, the SDK versions used across all of them, and how to switch between them in Android Studio.
SDK and versioning baseline
All three build types share the same SDK configuration defined in thedefaultConfig block of app/build.gradle.kts:
| Setting | Value |
|---|---|
compileSdk | 35 |
minSdk | 24 (Android 7.0+) |
targetSdk | 35 |
applicationId | com.laprevia.restobar |
versionCode and versionName are driven by the GITHUB_RUN_NUMBER environment variable so that every CI build automatically produces a unique, incrementing version number:
app/build.gradle.kts
GITHUB_RUN_NUMBER is not set, so versionCode falls back to 1 and versionName to 1.0.0.
Build types
debug
Targets the Android emulator. Cleartext HTTP allowed. No code shrinking.
BuildConfig.DEBUG = true.staging
Targets a physical device on the local network. Signed with the debug keystore. No code shrinking. Separate application ID suffix.
release
Targets the production API over HTTPS/WSS. R8 minification and resource shrinking enabled. No debug logging.
debug
Thedebug variant is intended for development on the Android Emulator. The emulator’s loopback address (10.0.2.2) is used as the backend host, mapping to localhost on the development machine. A PHYSICAL_BASE_URL field is also injected for developers who switch between emulator and physical device during the same session.
app/build.gradle.kts
staging
Thestaging variant is designed for testing on a physical device connected to the same Wi-Fi network as the development machine (192.168.0.104). It gets a distinct application ID suffix (.staging) so it can be installed alongside the release variant on the same device.
app/build.gradle.kts
BASE_URL and PHYSICAL_BASE_URL point to the same local IP because a physical device can never reach the emulator loopback address.
release
Therelease variant connects to the production API at api.laprevia.com over HTTPS and secure WebSockets. R8 (isMinifyEnabled = true) obfuscates the bytecode and isShrinkResources = true strips unused resources, reducing APK size. OkHttp logging is automatically disabled in release builds because BuildConfig.DEBUG is false.
app/build.gradle.kts
BuildConfig fields reference
The table below summarises everybuildConfigField injected per variant:
| Field | debug | staging | release |
|---|---|---|---|
ENVIRONMENT | "DEBUG" | "STAGING" | "RELEASE" |
BASE_URL | http://10.0.2.2:8080/ | http://192.168.0.104:8080/ | https://api.laprevia.com/ |
PHYSICAL_BASE_URL | http://192.168.0.104:8080/ | http://192.168.0.104:8080/ | https://api.laprevia.com/ |
WS_URL | ws://10.0.2.2:8080/ws | ws://192.168.0.104:8080/ws | wss://api.laprevia.com/ws |
PHYSICAL_WS_URL | ws://192.168.0.104:8080/ws | ws://192.168.0.104:8080/ws | wss://api.laprevia.com/ws |
FIREBASE_API_KEY | from local.properties | from local.properties | from local.properties |
NetworkModule reads these fields directly via BuildConfig:
app/src/main/java/com/laprevia/restobar/di/NetworkModule.kt
Network security configuration
Android blocks cleartext (HTTP) traffic by default. Thenetwork_security_config.xml resource explicitly permits it for the three local hosts used by debug and staging builds, while leaving all other traffic restricted to HTTPS:
app/src/main/res/xml/network_security_config.xml
Cleartext traffic is permitted only for the three local addresses listed above. Any domain not matched by a
<domain-config> block — including api.laprevia.com — is governed by the platform default, which enforces HTTPS on API level 28 and above.Switching build variants in Android Studio
Open the Build Variants panel
In Android Studio, go to View → Tool Windows → Build Variants (or click the Build Variants tab in the bottom-left toolbar).
Select the active variant
In the Build Variant column next to the
:app module, choose one of:debug— emulator developmentstaging— physical device on local networkrelease— production build
BuildConfig class.