stadiamaps / flutter-maplibre-gl-example

An example illustrating the MapLibre GL Native wrapper for Flutter
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Black screen error while the device offline #2

Closed mehmetkalayci closed 1 year ago

mehmetkalayci commented 1 year ago

Hello,

I'd like to use the app while the device offline but I got black screen. The logs are bellow.

Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
Debug service listening on ws://127.0.0.1:54627/hhXvahhHvmw=/ws
Syncing files to device sdk gphone x86 64...
I/e.maplibre_demo( 4955): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()
E/Mbgl    ( 4955): {DatabaseFileSou}[Database](11): Can't open database: database disk image is malformed
W/Mbgl    ( 4955): {DatabaseFileSou}[Database]: Removing existing incompatible offline database
W/Parcel  ( 4955): Expecting binder but got null!
I/flutter ( 4955): -----------------  installOfflineMapTiles worked
I/flutter ( 4955): _tilesLoaded--->true
I/PlatformViewsController( 4955): Hosting view in view hierarchy for platform view: 0
E/FrameEvents( 4955): updateAcquireFence: Did not find frame.
W/Parcel  ( 4955): Expecting binder but got null!
V/Mbgl-ConnectivityReceiver( 4955): connected - false
E/FrameEvents( 4955): updateAcquireFence: Did not find frame.
I/Mbgl-EGLConfigChooser( 4955): In emulator: false
D/HostConnection( 4955): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma ANDROID_EMU_hwc_multi_configs GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1 
D/EGL_emulation( 4955): eglCreateContext: 0x78a63621b690: maj 3 min 1 rcv 4
D/EGL_emulation( 4955): eglMakeCurrent: 0x78a63621b690: ver 3 1 (tinfo 0x78a852040280) (first time)
I/Mbgl    ( 4955): {Thread-4}[General]: GPU Identifier: Android Emulator OpenGL ES Translator (NVIDIA GeForce GTX 1660/PCIe/SSE2)
E/FrameEvents( 4955): updateAcquireFence: Did not find frame.
E/FrameEvents( 4955): updateAcquireFence: Did not find frame.

The modified code is bellow;

  bool _tilesLoaded = false;

  _copyTilesIntoPlace() async {
    try {
      await installOfflineMapTiles("assets/cache.db");
      print("-----------------  installOfflineMapTiles worked");
    } catch (err) {
      print(err);
    }
    setState(() {
      this._tilesLoaded = true;
    });
    print("_tilesLoaded--->" + _tilesLoaded.toString());
  }

  @override
  void initState() {
    _copyTilesIntoPlace();
    super.initState();
  }

When I run the app twice, cache.db loaded successfully.

I don't know how to load it properly.

ianthetechie commented 1 year ago

Just to clarify, is this a problem with our example project? It seems like you're trying to modify it to load in your own database of offline tiles, but I'm not sure how that's generated nor if this is an issue with our demo project. I would suggest the following steps:

  1. Publish a minimal reproducible example (MRE) to GitHub.
  2. Create an issue on the upstream project detailing what you're trying to accomplish and what you think is broken. It seems to be something related to offline tiles, but the maintainers would need to know things like where you got the cache database from at a minimium.
  3. Link it here for completeness so we can chime in if we'd be able to help + people arriving from search engines can see where the conversation continued.
mehmetkalayci commented 1 year ago

It was not a problem with your example project. But I change the maplibre_gl package with the following package https://github.com/flutter-mapbox-gl/maps.git then the same code worked fine.