Files
trainingstagebuch/mobile-app/DEVELOPMENT.md
Torsten Schulz (local) 48f71b9df1
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 44s
chore: update .gitignore and enhance backend and mobile app functionality
- Added mobile app build directories and configuration files to .gitignore for cleaner repository management.
- Improved error handling in diaryMemberController by requiring diaryDateId and memberId query parameters.
- Refactored DiaryMemberService to log tag IDs instead of raw values for better debugging.
- Enhanced TournamentParticipantsTab and TournamentTab components with improved touch-action properties for better user experience.
- Updated mobile app's gradle.properties and build.gradle.kts for compatibility with AGP 9.x and Kotlin 2.1.21, including new dependencies for Coil and UCrop.
- Refactored MainApplication to simplify initialization and improved MainActivity to handle dependencies more robustly.
- Updated various UI components in the mobile app to enhance layout and functionality, including MemberDetailScreen and MemberEditScreen.
2026-05-12 23:14:31 +02:00

3.3 KiB
Raw Blame History

Development

Backend-URL

Standard: https://tt-tagebuch.de gesetzt in gradle.properties (backendBaseUrl=…) und als Fallback in composeApp/build.gradle.kts.

Für lokale Entwicklung läuft der Backend-Server auf deinem Rechner typischerweise unter http://localhost:3005.

Die Android-Studio-VM (Emulator) kann localhost / 127.0.0.1 nicht für diesen lokalen Server nutzen: dort ist „localhost“ der Emulator selbst, nicht dein PC. Für lokale Emulator-Tests nutze http://10.0.2.2:3005.

HTTP / Cleartext: Ab Android 9 blockiert das System unverschlüsseltes HTTP standardmäßig. Für die lokale Dev-URL ist das in composeApp/src/androidMain/res/xml/network_security_config.xml für 10.0.2.2, localhost und 127.0.0.1 freigegeben.
Testest du mit der LAN-IP deines PCs (echtes Gerät), musst du diese IP dort als weiteres <domain> ergänzen oder kurzzeitig HTTPS nutzen.

Wenn die App trotz Rebuild noch localhost zeigt

  1. Android Studio überschreibt Gradle:
    Settings → Build, Execution, Deployment → Build Tools → Gradle
    beim Projekt mobile-app prüfen, ob unter Command-line options etwas wie
    -PbackendBaseUrl=http://localhost:3005 steht das entfernen oder bewusst setzen.

  2. Alte Installation / Build-Cache: Emulator-App deinstallieren, Clean, neu installieren:

    cd mobile-app
    adb uninstall de.tt_tagebuch.app
    ./gradlew :composeApp:clean :composeApp:installDebug --no-configuration-cache
    

    Oder das Skript: ./scripts/install-debug-emulator.sh

  3. BuildConfig prüfen: Nach dem Build in
    composeApp/build/generated/.../BuildConfig.java
    den Wert von BACKEND_BASE_URL ansehen der muss https://tt-tagebuch.de sein (oder deine bewusste Override-URL).

Android Studio „Run“ geht nicht

  • Projekt mobile-app/ als Root öffnen (nicht nur den übergeordneten Monorepo-Ordner, wenn Studio das Modul nicht erkennt).
  • Run → Edit Configurations → Android App: Modul composeApp wählen.
  • Alternativ immer über die Kommandozeile installieren (siehe oben) und die App im Emulator starten.

Überschreiben per Gradle-Property, z. B. lokaler Emulator:

./gradlew :composeApp:installDebug -PbackendBaseUrl=http://10.0.2.2:3005

Alternative: Port vom PC auf den Emulator weiterleiten, dann geht wieder localhost:

adb reverse tcp:3005 tcp:3005
./gradlew :composeApp:installDebug -PbackendBaseUrl=http://localhost:3005

Smoke flow (Android)

  1. Start backend (default http://localhost:3005)
  2. Start Android emulator
  3. App installieren: ./scripts/install-debug-emulator.sh oder Run in Studio (Modul composeApp)
  4. Login → Club auswählen → Rolle wird angezeigt
  5. Open Tagebuch → die letzten Einträge werden angezeigt

Gradle Wrapper

Use the wrapper from mobile-app/:

cd mobile-app
./gradlew tasks

Note (Codex sandbox only): the sandbox home directory is read-only, so run with:

GRADLE_USER_HOME=/tmp/gradle-home ./gradlew tasks

i18n generation

node scripts/generate-mobile-i18n.js

This reads all web locale JSON files and writes the generated KMP bundle to mobile-app/shared/src/commonMain/kotlin/de/tt_tagebuch/shared/i18n/MobileStrings.kt.

Build

Recommended:

  • Open mobile-app/ in Android Studio and run the composeApp configuration.