Skip to content

fix(mobile,map-pipeline): fix Android release R8 MapLibre crash and offline region PMTiles downloads - #285

Merged
markusbrand merged 4 commits into
mainfrom
fix/android-release-map-and-region-downloads
Nov 14, 2026
Merged

markusbrand merged 4 commits into
mainfrom
fix/android-release-map-and-region-downloads

Conversation

@markusbrand

@markusbrand markusbrand commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Resolves two root causes behind the missing map background and broken ~2-second offline region downloads on Android release builds:

  1. Android Release R8 Obfuscation Crash (PlatformViewsController NullPointerException):

    • Added apps/mobile/android/app/proguard-rules.pro and wired it into apps/mobile/android/app/build.gradle.kts (buildTypes.release) to preserve io.flutter.plugin.platform.**, io.flutter.embedding.engine.plugins.**, io.flutter.plugin.common.**, com.github.josxha.maplibre.**, com.github.dart_lang.jni.**, and org.maplibre.**.
    • Verified in mapping.txt and on the physical Android tablet (KFQUWI / GCC1WE0421540ECA) that MapLibreMap mounts with zero PlatformException / NullPointerException errors.
  2. Offline Region Downloads & Self-Healing Validation:

    • Removed _fallbackDownloadFromBundle() from RegionManagerService so network/HTTP errors transition to DownloadStatus.failed instead of silently copying the 499-byte global_overview.pmtiles stub into regions/<id>/map.pmtiles and claiming a multi-MB download succeeded in ~2 seconds.
    • Added PMTiles v3 magic header ("PMTiles\x03") and minimum size (>= 4096 bytes) validation in RegionManagerService and MapLibreMapService, plus automatic self-healing cleanup of previously written stub region directories.
    • Added explicit maxzoom on vector (primaryMaxZoom ?? 14) and terrain (terrainMaxZoom ?? 12) sources in MapLibreMapService.buildStyleJson() and clamped DEM zoom in ElevationService so MapLibre Native overzooms regional PMTiles smoothly.
  3. Map Pipeline & GitHub Releases (maps-v1) Hosting:

    • Updated tools/map-pipeline/generate_vector_tiles.py (--storage=mmap --force), generate_catalog.py, regions.yaml, and publish_github_release.sh to publish regional PMTiles and catalog.json to https://github.com/markusbrand/brandyfly/releases/tag/maps-v1.
    • Generated and published all 8 regional vector + terrain-RGB PMTiles archives and catalog.json to maps-v1, and updated apps/mobile/assets/map_data/catalog.json.

Verification

  • flutter test test/services/region_manager_service_test.dart test/services/maplibre_map_service_test.dart test/widgets/region_manager_ui_test.dart (19/19 passed)
  • python3 tools/map-pipeline/test_pipeline.py (7/7 passed)
  • npx openspec validate --all --strict (35/35 passed)
  • End-to-end verified on the connected KFQUWI Android tablet (GCC1WE0421540ECA): map background renders 3D hillshade + vector features, stub region directory self-healed on launch, and downloading Alps - Eastern (66.6 MB) in Settings downloaded, verified SHA-256 checksums, and rendered offline vector & terrain tiles.

@markusbrand
markusbrand merged commit 0cec0c6 into main Nov 14, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant