Code Monkey home page Code Monkey logo

maps's Introduction

Flutter Mapbox GL

Please note that this project is community driven and is not an official Mapbox product.

We welcome feedback and contributions.

Table of contents

Introduction

This Flutter plugin allows to show embedded interactive and customizable vector maps inside a Flutter widget. For the Android and iOS integration, we use mapbox-gl-native. For web, we rely on mapbox-gl-js. This project only supports a subset of the API exposed by these libraries.

screenshot.png

Setting up

This package is available on pub.dev.

Get it by running the following command:

flutter pub add mapbox_gl

Mobile

Secret Mapbox access token

A secret access token with the Downloads: Read scope is required for the underlying Mapbox SDKs to be downloaded. Information on setting it up is available in the Mapbox documentation: Android, iOS.

If the properly configured token is not present, the build process fails with one the following errors (for Android/iOS respectively):

* What went wrong:
A problem occurred evaluating project ':mapbox_gl'.
> SDK Registry token is null. See README.md for more information.
[!] Error installing Mapbox-iOS-SDK
curl: (22) The requested URL returned error: 401 Unauthorized

Web

Include the JavaScript and CSS files in the <head> of your index.html file:

<script src='https://api.mapbox.com/mapbox-gl-js/v2.8.2/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.8.2/mapbox-gl.css' rel='stylesheet' />

<style>
   .mapboxgl-map {
      position: relative;
      width: 100%;
      height: 100%;
    }
</style>

Note: Look for latest version in Mapbox GL JS documentation.

All platforms

Public Mapbox access token

A public access token must be provided to a MapboxMap widget for retrieving styles and resources. While you can hardcode it directly into source files, it's good practise to retrieve access tokens from some external source (e.g. a config file or an environment variable). The example app uses the following technique:

The access token is passed via the command line arguments when either building

flutter build <platform> --dart-define ACCESS_TOKEN=YOUR_TOKEN_HERE

or running the application

flutter run --dart-define ACCESS_TOKEN=YOUR_TOKEN_HERE

Then it's retrieved in Dart:

MapboxMap(
  ...
  accessToken: const String.fromEnvironment("ACCESS_TOKEN"),
  ...
)

Supported API

Feature Android iOS Web
Style
Camera
Gesture
User Location
Style DSL
Raster Layer
Symbol Layer
Circle Layer
Line Layer
Fill Layer
Fill Extrusion Layer
Hillshade Layer
Heatmap Layer
Vector Source
Raster Source
GeoJson Source
Image Source
Expressions
Symbol Annotation
Circle Annotation
Line Annotation
Fill Annotation

Map Styles

Map styles can be supplied by setting the styleString in the MapOptions. The following formats are supported:

  1. Passing the URL of the map style. This can be one of the built-in map styles, also see MapboxStyles or a custom map style served remotely using a URL that start with 'http(s)://' or 'mapbox://'
  2. Passing the style as a local asset. Create a JSON file in the assets and add a reference in pubspec.yml. Set the style string to the relative path for this asset in order to load it into the map.
  3. Passing the style as a local file. create an JSON file in app directory (e.g. ApplicationDocumentsDirectory). Set the style string to the absolute path of this JSON file.
  4. Passing the raw JSON of the map style. This is only supported on Android.

Offline Sideloading

Support for offline maps is available by side loading the required map tiles and including them in your assets folder.

  • Create your tiles package by following the guide available here.

  • Place the tiles.db file generated in step one in your assets directory and add a reference to it in your pubspec.yml file.

   assets:
     - assets/cache.db
  • Call installOfflineMapTiles when your application starts to copy your tiles into the location where Mapbox can access them. NOTE: This method should be called before the Map widget is loaded to prevent collisions when copying the files into place.
    try {
      await installOfflineMapTiles(join("assets", "cache.db"));
    } catch (err) {
      print(err);
    }

Downloading Offline Regions

An offline region is a defined region of a map that is available for use in conditions with limited or no network connection. Tiles for selected region, style and precision are downloaded from Mapbox using proper SDK methods and stored in application's cache.

  • Beware of selecting big regions, as size might be significant. Here is an online estimator https://docs.mapbox.com/playground/offline-estimator/.

  • Call downloadOfflineRegionStream with predefined OfflineRegion and optionally track progress in the callback function.

    final Function(DownloadRegionStatus event) onEvent = (DownloadRegionStatus status) {
      if (status.runtimeType == Success) {
        // ...
      } else if (status.runtimeType == InProgress) {
        int progress = (status as InProgress).progress.round();
        // ...
      } else if (status.runtimeType == Error) {
        // ...
      }
    };

    final OfflineRegion offlineRegion = OfflineRegion(
      bounds: LatLngBounds(
        northeast: LatLng(52.5050648, 13.3915634),
        southwest: LatLng(52.4943073, 13.4055383),
      ),
      id: 1,
      minZoom: 6,
      maxZoom: 18,
      mapStyleUrl: 'mapbox://styles/mapbox/streets-v11',
    );

    downloadOfflineRegionStream(offlineRegion, onEvent);

Create a static map snapshot

The snapshotManager generates static raster images of the map. Each snapshot image depicts a portion of a map defined by an SnapshotOptions object you provide.

  • Call takeSnapshot with predefined SnapshotOptions
    final renderBox = mapKey.currentContext?.findRenderObject() as RenderBox;

    final snapshotOptions = SnapshotOptions(
      width: renderBox.size.width,
      height: renderBox.size.height,
      writeToDisk: true,
      withLogo: false,
    );
    
    final uri = await mapController?.takeSnapshot(snapshotOptions);

Location features

Android

Add the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in the application manifest android/app/src/main/AndroidManifest.xml to enable location features in an Android application:

<manifest ...
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Starting from Android API level 23 you also need to request it at runtime. This plugin does not handle this for you. The example app uses the flutter 'location' plugin for this.

iOS

To enable location features in an iOS application:

If you access your users' location, you should also add the following key to ios/Runner/Info.plist to explain why you need access to their location data:

xml ...
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>[Your explanation here]</string>

Recommended explanation about "Shows your location on the map and helps improve the map".

Flutter 3.x.x issues and experimental workarounds

Since Flutter 3.x.x was introduced, it exposed some race conditions resulting in occasional crashes upon map disposal. The parameter useDelayedDisposal was introduced as a workaround for this issue until Flutter and/or Mapbox fix this issue properly. Use with caution - this is not yet production ready since several users still report crashes after using this workaround.

Running the example code

See the documentation about this topic

Contributing

We welcome contributions to this repository! If you're interested in helping build this Mapbox-Flutter integration, please read the contribution guide to learn how to get started.

maps's People

Contributors

aardrop avatar aaverin avatar ahm322 avatar akandratovich avatar alextychan avatar andrea689 avatar ayvazj avatar cuberob avatar felix-ht avatar gulertolga avatar hungtrn75 avatar iamswain25 avatar jamesblasco avatar m0nac0 avatar maximumbuster avatar morvagergely avatar n8han avatar pawlowskim avatar philiplindberg avatar samderlust avatar sebastiansmolorz avatar shroff avatar srmncnk avatar strepier avatar subchord avatar tainanfochesatto avatar timothysealy avatar tobrun avatar vincekruger avatar yoavrofe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maps's Issues

Controls and fonts are not smooth

I have installed the example project in my android device. Unfortunately the map control such as zoom in zoom out or panning is not so smooth and sometime stuck with no movement. Moreover the fonts seems like broken sometimes, not so smooth. Seems like this plugins is not ready for any production.
Screenshot_2019-04-18-22-41-23-536_com mapbox mapboxglexample

TextureView vs. GLSurfaceView - orientation change #74

Original issue from mapbox/flutter-mapbox-gl#74 by @moodstubos


First of all I would like to say thanks to @yoavrofe for the last commit (#71). I am pretty sure using platformview is the correct way.

While testing I realized mapbox crashes after rotation change.

It can be prevented by using TextureView instead of GLSurfaceView:

MapboxMapOptions mbmo = new MapboxMapOptions();
mbmo.textureMode(true);
mapView = new MapView(context, mbmo);

Crash log:

D/EGL_emulation( 5197): eglCreateContext: 0xe0005360: maj 2 min 0 rcv 2 F/mapboxglexampl( 5197): java_vm_ext.cc:542] JNI DETECTED ERROR IN APPLICATION: thread Thread[14,tid=5273,Native,Thread*=0xdfd46600,peer=0x1310a568,"GLThread 363"] using JNIEnv* from thread Thread[23,tid=5243,Runnable,Thread*=0xcb617800,peer=0x0," F/mapboxglexampl( 5197): java_vm_ext.cc:542] in call to DeleteGlobalRef F/mapboxglexampl( 5197): java_vm_ext.cc:542] from void com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeOnSurfaceCreated() F/mapboxglexampl( 5197): java_vm_ext.cc:542] "GLThread 363" prio=5 tid=14 Runnable F/mapboxglexampl( 5197): java_vm_ext.cc:542] | group="main" sCount=0 dsCount=0 flags=0 obj=0x1310a568 self=0xdfd46600 F/mapboxglexampl( 5197): java_vm_ext.cc:542] | sysTid=5273 nice=0 cgrp=default sched=0/0 handle=0xc8e7f970 F/mapboxglexampl( 5197): java_vm_ext.cc:542] | state=R schedstat=( 6355962 778233 50 ) utm=0 stm=0 core=2 HZ=100 F/mapboxglexampl( 5197): java_vm_ext.cc:542] | stack=0xc8d7c000-0xc8d7e000 stackSize=1042KB F/mapboxglexampl( 5197): java_vm_ext.cc:542] | held mutexes= "mutator lock"(shared held) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #00 pc 004152f6 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+198) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #1 pc 0051048e /system/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits>&, bool, BacktraceMap*, bool) const+382) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #2 pc 0050b743 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits>&, bool, BacktraceMap*, bool) const+83) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #3 pc 0031a8b0 /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1088) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #4 pc 0031ad21 /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, char*)+113) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #5 pc 000d60f7 /system/lib/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+71) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #6 pc 000d46fc /system/lib/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+364) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #7 pc 000d3bdb /system/lib/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+811) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #8 pc 000d7876 /system/lib/libart.so (art::(anonymous namespace)::CheckJNI::DeleteRef(char const*, _JNIEnv*, _jobject*, art::IndirectRefKind)+918) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #9 pc 000c034b /system/lib/libart.so (art::(anonymous namespace)::CheckJNI::DeleteGlobalRef(_JNIEnv*, _jobject*)+43) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #10 pc 00024800 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #11 pc 00025f9b /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #12 pc 00025fe3 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #13 pc 00113407 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #14 pc 0008a885 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #15 pc 0008a8cf /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #16 pc 00086f82 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #17 pc 00065829 /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/lib/x86/libmapbox-gl.so (???) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #18 pc 005f6b97 /system/lib/libart.so (art_quick_generic_jni_trampoline+71) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #19 pc 005f0b82 /system/lib/libart.so (art_quick_invoke_stub+338) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #20 pc 000a30ce /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+222) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #21 pc 0029bca2 /system/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+338) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #22 pc 00293e48 /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1048) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #23 pc 005bda66 /system/lib/libart.so (MterpInvokeDirect+342) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #24 pc 005e2e21 /system/lib/libart.so (ExecuteMterpImpl+14497) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #25 pc 00198dd0 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceCreated) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #26 pc 00266216 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #27 pc 0026c79c /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #28 pc 00293e2b /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #29 pc 005bcb1e /system/lib/libart.so (MterpInvokeSuper+1374) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #30 pc 005e2da1 /system/lib/libart.so (ExecuteMterpImpl+14369) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #31 pc 001999f8 /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onSurfaceCreated) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #32 pc 00266216 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #33 pc 0026c79c /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #34 pc 00293e2b /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #35 pc 005bcb1e /system/lib/libart.so (MterpInvokeSuper+1374) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #36 pc 005e2da1 /system/lib/libart.so (ExecuteMterpImpl+14369) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #37 pc 0018f2da /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-ZWRbu4E5v47YrcHxFSnE2Q==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.MapView$5.onSurfaceCreated+10) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #38 pc 00266216 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #39 pc 0026c79c /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #40 pc 00293e2b /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #41 pc 005bd574 /system/lib/libart.so (MterpInvokeInterface+1444) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #42 pc 005e2f21 /system/lib/libart.so (ExecuteMterpImpl+14753) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #43 pc 00ad5566 /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.guardedRun+900) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #44 pc 00266216 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #45 pc 0026c79c /system/lib/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+220) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #46 pc 00293e2b /system/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1019) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #47 pc 005bda66 /system/lib/libart.so (MterpInvokeDirect+342) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #48 pc 005e2e21 /system/lib/libart.so (ExecuteMterpImpl+14497) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #49 pc 00ad5b00 /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.run+48) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #50 pc 00266216 /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2093054539+598) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #51 pc 0026c68e /system/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+126) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #52 pc 005a953d /system/lib/libart.so (artQuickToInterpreterBridge+1277) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #53 pc 005f6c6d /system/lib/libart.so (art_quick_to_interpreter_bridge+77) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #54 pc 005f0b82 /system/lib/libart.so (art_quick_invoke_stub+338) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #55 pc 000a30ce /system/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+222) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #56 pc 004d3349 /system/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+89) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #57 pc 004d45f7 /system/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+471) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #58 pc 0050958c /system/lib/libart.so (art::Thread::CreateCallback(void*)+1484) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #59 pc 0008f005 /system/lib/libc.so (__pthread_start(void*)+53) F/mapboxglexampl( 5197): java_vm_ext.cc:542] native: #60 pc 000247fb /system/lib/libc.so (__start_thread+75) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeOnSurfaceCreated(Native method) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceCreated(MapRenderer.java:63) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onSurfaceCreated(GLSurfaceViewMapRenderer.java:48) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at com.mapbox.mapboxsdk.maps.MapView$5.onSurfaceCreated(MapView.java:316) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539) F/mapboxglexampl( 5197): java_vm_ext.cc:542] at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270) F/mapboxglexampl( 5197): java_vm_ext.cc:542]

pod install fails unless Swift version is specified in mapbox_gl.podspec

I'm getting the following error when trying to run the example app in iOS Simulator during the pod install process:

Unable to determine Swift version for the following pods:
    - `mapbox_gl` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

Adding s.swift_version = '5.0' to ios/mapbox_gl.podspec fixes the issue.

Improve contribution guide (iOS)

I can't seem to open the plugin code in XCode. From my IDE (Android Studio) I can open the iOS example project in XCode but not the plugin code. I can open the Swift files in XCode but adding new files does not seem to have effect (I'm assuming this is because they need to be referenced to a project or workspace). Some documentation on how to setup the development environment (for iOS) would be great.

Also, the contribution guide links to the install process documentation in the original mapbox repository (which has recently been archives).

Clicking the info icon crashes app #72

Orginal issue from mapbox/flutter-mapbox-gl#72 by @tobrun


Crashes with following stacktrace:

E/AndroidRuntime( 2088): Process: com.mapbox.mapboxglexample, PID: 2088
E/AndroidRuntime( 2088): java.lang.ClassCastException: $Proxy1 cannot be cast to android.view.WindowManagerImpl
E/AndroidRuntime( 2088): 	at android.view.Window.setWindowManager(Window.java:770)
E/AndroidRuntime( 2088): 	at android.view.Window.setWindowManager(Window.java:751)
E/AndroidRuntime( 2088): 	at android.app.Dialog.<init>(Dialog.java:220)
E/AndroidRuntime( 2088): 	at android.app.AlertDialog.<init>(AlertDialog.java:201)
E/AndroidRuntime( 2088): 	at android.app.AlertDialog$Builder.create(AlertDialog.java:1107)
E/AndroidRuntime( 2088): 	at android.app.AlertDialog$Builder.show(AlertDialog.java:1134)
E/AndroidRuntime( 2088): 	at com.mapbox.mapboxsdk.maps.AttributionDialogManager.showAttributionDialog(AttributionDialogManager.java:73)
E/AndroidRuntime( 2088): 	at com.mapbox.mapboxsdk.maps.AttributionDialogManager.onClick(AttributionDialogManager.java:65)
E/AndroidRuntime( 2088): 	at com.mapbox.mapboxsdk.maps.MapView$AttributionClickListener.onClick(MapView.java:1744)
E/AndroidRuntime( 2088): 	at android.view.View.performClick(View.java:6877)
E/AndroidRuntime( 2088): 	at android.view.View$PerformClick.run(View.java:26069)
E/AndroidRuntime( 2088): 	at android.os.Handler.handleCallback(Handler.java:789)
E/AndroidRuntime( 2088): 	at android.os.Handler.dispatchMessage(Handler.java:98)
E/AndroidRuntime( 2088): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 2088): 	at android.app.ActivityThread.main(ActivityThread.java:6938)
E/AndroidRuntime( 2088): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2088): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
E/AndroidRuntime( 2088): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Reply by @yoavrofe :


We have a similar problem when placing a simple TextField in the map. tapping the TextField crashes the app.
Hot reload also causes the app to crash.

These are critical bugs, and we'll appreciate your help, @tobrun .

Here's the stacktrace for the TextField crash:

E/SpannableStringBuilder(18472): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
I/chatty  (18472): uid=10207(com.mapbox.mapboxglexample) identical 2 lines
E/SpannableStringBuilder(18472): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
I/Adreno  (18472): DequeueBuffer: dequeueBuffer failed
I/Adreno  (18472): DequeueBuffer: dequeueBuffer failed
I/Adreno  (18472): DequeueBuffer: dequeueBuffer failed
W/OpenGLRenderer(18472): swapBuffers encountered EGL error 12301 on 0x77ab61cf80, halting rendering...
D/libEGL  (18472): eglInitialize: enter
D/libEGL  (18472): eglInitialize: exit(res=1)
I/Mbgl-EGLConfigChooser(18472): In emulator: false
W/com.mapbox.mapboxglexample(18472): type=1400 audit(0.0:171058): avc: denied { search } for comm=474C546872656164203731313631 name="ctx" dev="debugfs" ino=15054 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:qti_debugfs:s0 tclass=dir permissive=0
F/libc    (18472): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xb0 in tid 18882 (GLThread 71161), pid 18472 (mapboxglexample)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/beryllium/beryllium:9/PKQ1.180729.001/V10.1.3.0.PEJMIFI:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 18472, tid: 18882, name: GLThread 71161  >>> com.mapbox.mapboxglexample <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xb0
Cause: null pointer dereference
x0  00000077be06b100  x1  0000000000003466  x2  00000077a0e00000  x3  000000000000000e
x4  000000000000006e  x5  0000000000000000  x6  00000077a0951cc0  x7  00000077a0951d00
x8  0000000000000000  x9  2e817e2dedba37d0  x10 000000000000006e  x11 0000000000000000
x12 000000779fdff880  x13 00000077a0951c00  x14 00000000311ebe08  x15 00000077a0dbde30
x16 0000007849070be0  x17 000000784900356c  x18 0000000000000008  x19 00000077a0fb8420
x20 00000077a0e74ee0  x21 00000077bc859ac0  x22 00000077af321470  x23 00000077af959a55
x24 0000000000000004  x25 00000077a4dff588  x26 00000077a4dff588  x27 0000000000000001
x28 00000077a4dfda80  x29 00000077a4dfd8a0
sp  00000077a4dfd8a0  lr  00000077a22c68f0  pc  00000077a22c5478
backtrace:
#00 pc 0000000000045478  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#01 pc 00000000000468ec  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#02 pc 0000000000046934  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#03 pc 0000000000126e54  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#04 pc 00000000000ab5c4  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#05 pc 00000000000ab60c  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#06 pc 00000000000a81e4  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#07 pc 0000000000089868  /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/lib/arm64/libmapbox-gl.so
#08 pc 000000000055f5e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
#09 pc 0000000000556588  /system/lib64/libart.so (art_quick_invoke_stub+584)
#10 pc 00000000000cfcc8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#11 pc 0000000000280338  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#12 pc 000000000027a34c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
#13 pc 00000000005275c8  /system/lib64/libart.so (MterpInvokeDirect+296)
#14 pc 0000000000548c94  /system/lib64/libart.so (ExecuteMterpImpl+14484)
#15 pc 0000000000197134  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceCreated)
#16 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2198905147+488)
#17 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#18 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#19 pc 0000000000526920  /system/lib64/libart.so (MterpInvokeSuper+1420)
#20 pc 0000000000548c14  /system/lib64/libart.so (ExecuteMterpImpl+14356)
#21 pc 0000000000197d5c  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onSurfaceCreated)
#22 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2198905147+488)
#23 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#24 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#25 pc 0000000000526920  /system/lib64/libart.so (MterpInvokeSuper+1420)
#26 pc 0000000000548c14  /system/lib64/libart.so (ExecuteMterpImpl+14356)
#27 pc 000000000018d63e  /dev/ashmem/dalvik-classes.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-E2CTrhJAtG7aPvrRHPfHsQ==/base.apk (deleted) (com.mapbox.mapboxsdk.maps.MapView$5.onSurfaceCreated+10)
#28 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2198905147+488)
#29 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#30 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#31 pc 0000000000527204  /system/lib64/libart.so (MterpInvokeInterface+1392)
#32 pc 0000000000548d94  /system/lib64/libart.so (ExecuteMterpImpl+14740)
#33 pc 0000000000b84e14  /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.guardedRun+888)
#34 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2198905147+488)
#35 pc 0000000000259b44  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#36 pc 000000000027a330  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#37 pc 00000000005275c8  /system/lib64/libart.so (MterpInvokeDirect+296)
#38 pc 0000000000548c94  /system/lib64/libart.so (ExecuteMterpImpl+14484)
#39 pc 0000000000b8546c  /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.run+48)
#40 pc 0000000000254050  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.2198905147+488)
#41 pc 0000000000516b3c  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
#42 pc 000000000055f6fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#43 pc 0000000000556588  /system/lib64/libart.so (art_quick_invoke_stub+584)
#44 pc 00000000000cfcc8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#45 pc 000000000045dba4  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#46 pc 000000000045ec60  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
#47 pc 0000000000489ae8  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
#48 pc 0000000000081dac  /system/lib64/libc.so (__pthread_start(void*)+36)
#49 pc 0000000000023788  /system/lib64/libc.so (__start_thread+68)
Lost connection to device.
Exited (sigterm)

addImage support for symbol icons

We currently don't have a way to set an image to the currently loaded style. Atm we can only reference icon ids of images downloaded as part of the style spritesheet.

Draw on map

Is there a way to draw on top of the map?

For instance, say:

  • I have an Uber-like app, and I want to move a car symbol and draw a line on the path it took.
  • I want to mark an area of interest (e.g. draw a translucid polygon on top of the map), and have interactive handles to it (so the user can increase the size of that area or change its shape).

Is there currently a way to do that, or should I somehow draw on some transparent canvas on top of the map? And in the latter case, can I know that the map moved in order to update the canvas? Would that look "smooth", or would we see that the map and the canvas are not synchronized?

iOS sometimes scroll gesture generate exception

Sometimes while scroll the map, the touch isn't intercept and this error is thrown:

Unhandled Exception: 'package:flutter/src/gestures/converter.dart': Failed assertion: line 155 pos 18: '!state.down': is not true.
#0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
#2      PointerEventConverter.expand (package:flutter/src/gestures/converter.dart:155:18)
#3      _SyncIterator.moveNext (dart:core/runtime/libcore_patch.dart:152:12)
#4      ListQueue.addAll (dart:collection/queue.dart:715:25)
#5      _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:83:27)
#6      _rootRunUnary (dart:async/zone.dart:1136:13)
#7      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#9      _invoke1 (dart:ui/hooks.dart:203:10)
#10     _dispatchPointerDataPacket (dart:ui/hooks.dart:138:5)

Add support for style API

Provide an API matching style specification:

  • style object
  • layers
  • sources
  • transition options
  • ...

Todo: look into auto generating this from the style spec definiton using upstream mapbox-gl-native tooling.

No implementation found for method #add in example

I've only tested this in iOS Simulator.

Calling addCircle, addSymbol or addLine on MapboxMapController will fail with below errors.

To replicate:

  1. flutter run on example
  2. Navigate to 'Place symbol, 'Line' or 'Place circle' Page
  3. Click add
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method circle#add on channel plugins.flutter.io/mapbox_maps_0)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
<asynchronous suspension>
#1      MapboxMapController.addCircle (file:///Users/gerald/Projects/flutter-mapbox-gl/lib/src/controller.dart:371:44)
<asynchronous suspension>
#2      PlaceCircleBodyState._add (package:mapbox_gl_example/place_circle.dart:69:16)
#3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
#4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
#5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
#6      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
#7      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
#8      PrimaryPointerGestu<…>

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method symbol#add on channel plugins.flutter.io/mapbox_maps_1)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
<asynchronous suspension>
#1      MapboxMapController.addSymbol (file:///Users/gerald/Projects/flutter-mapbox-gl/lib/src/controller.dart:207:44)
<asynchronous suspension>
#2      PlaceSymbolBodyState._add (package:mapbox_gl_example/place_symbol.dart:69:16)
#3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
#4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
#5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
#6      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
#7      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
#8      PrimaryPointerGestu<…>

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method line#add on channel plugins.flutter.io/mapbox_maps_2)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
<asynchronous suspension>
#1      MapboxMapController.addLine (file:///Users/gerald/Projects/flutter-mapbox-gl/lib/src/controller.dart:289:42)
<asynchronous suspension>
#2      LineBodyState._add (package:mapbox_gl_example/line.dart:71:16)
#3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
#4      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
#5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
#6      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
#7      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
#8      PrimaryPointerGestureRecognizer.handle<…>

Master ticket: missing APIs

This is a place holder ticket to capture all missing features and APIs:

  • Add annotation APIs with annotation plugin #11
  • Add styleJSON and styleURL support
  • Add onMapClick
  • Add queryRenderedFeatures
  • TBA more features

Crash app if missing accesstoken

Atm if an accesstoken is missing, the app opens but no map is rendered. This can be confusing, let make this more explicit by crashing the app if not accesstoken was provided.

mapbox_gl does not specify a Swift version

can't build the example project. mapbox_gl does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.32.3)
[✓] Connected device (1 available)

Tile Overlays

I have the url https://some_string/z/x/y.png. This url contains tiles with the map points, that I need to display on the map. Can I display those tiles over base map with this plugin?

Master builds are broken

Currently master is compiling but not running for me:

2019-03-09 11:46:46.828 12437-12437/com.mapbox.mapboxglexample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mapbox.mapboxglexample, PID: 12437
java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.ProcessLifecycleOwnerInitializer: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/base.apk"],nativeLibraryDirectories=[/data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/lib/arm64, /data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:6249)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5812)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5729)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6501)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/base.apk"],nativeLibraryDirectories=[/data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/lib/arm64, /data/app/com.mapbox.mapboxglexample-nuAHpUG1WsyTeS6O4FLb2A==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.installProvider(ActivityThread.java:6234)

TBI which commit introduced the regression, this issue clearly shows we need CI integration.

Add attribution

With #12, we disabled the crashing attribution integration. This issue tracks re-adding this with using a flutter component instead.

Custom styles don't work on iOS

First off thanks for putting in the time on this plugin :)

I noticed today that the styleString parameter doesn't work on iOS. I'm using a custom style (built in Mapbox Studio), and I pass the mapbox:// URL for it to styleString. On Android it works fine, and the style is applied as expected. On iOS however it has no effect.

I think I have tracked down the problem to this class, which filters out all custom style URLs. I'm not familiar enough with Mapbox on iOS to know if this is by design though, or I would have raised a PR for a fix.

Move accesstoken configuration to flutter

The example in the repository specifies adding an accesstoken to both android xml resources as iOS Info.plist. Would be great if we can specify the accesstoken as a flutter resource and it get's picked up by the different plugins.

Error iOS import statement

Hi I have the error:

=== BUILD TARGET mapbox_gl OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/macbookpro/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.0.3/ios/Classes/MapboxMapsPlugin.m:1:9: fatal error: 'mapbox_gl/mapbox_gl-Swift.h' file not found
#import <mapbox_gl/mapbox_gl-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

I am trying to run the app on the simulator and iPhone 5s I get this type of error, anyone know how to fix this?

Thank you in advance

gesture lugish

Hi,
We have made a test app with latest stable flutter sdk.
but zoom gesture works lugish and incorrect not zooming with correct registration point (between thumbs)

the mapbox_Gl example works great but when using from scratch we are getting weird behaviors like below.

Do you have any idea what can cause such issues ?

this is our flutter --version output

Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (3 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

mapbox_gl: ^0.0.3

Accessor and model object for location

I need a button when it is pressed move Camera to user location.

but i can't find user location.(MapboxMapController have cameraPosition,but not user loaction)

and i can't get current circle location by _selectedCircle.options.geometry if i set circle draggable.

have any solution?
thanks for any help :)

Wire up user location API to iOS SDK

Add iOS integration for user location:

Flutter API is exposed as a flag to show the user location and an enum to define how the location impacts the camera (listed below).

/// The camera mode, which determines how the map camera will track the rendered location.
enum MyLocationTrackingMode {
  None,
  Tracking,
  TrackingCompass,
  TrackingGPS,
}

App freezes on mapView.onDestroy

I have updated mapbox-android-sdk to 7.2.0 and the app freezes on mapView.onDestroy()
I have the same problem if I set textureMode(false)

Web support

Project hummingbird enables running flutter on the web, more info in this medium post. This project could leverage this by hooking up mapbox-gl-js in case of running in a web env, this would extend the reach of this project further to the web, not only mobile.

Error with Flutter Run

Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:16: ����: �Ҳ�������
import androidx.annotation.NonNull;
                          ^
  ����:   �� NonNull
  �: ����� androidx.annotation
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:130: ����: �Ҳ�������
  private static String getAccessToken(@NonNull Context context) {
                                        ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:298: ����: �Ҳ�������
  private void enableLocationComponent(@NonNull Style style) {
                                        ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:315: ����: �Ҳ�������
  private void enableSymbolManager(@NonNull Style style) {
                                    ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:326: ����: �Ҳ�������
  private void enableLineManager(@NonNull Style style) {
                                  ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:333: ����: �Ҳ�������
  private void enableCircleManager(@NonNull Style style) {
                                    ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:556: ����: �Ҳ�������
  public boolean onMapClick(@NonNull LatLng point) {
                             ^
  ����:   �� NonNull
  �: �� MapboxMapController
D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\mapbox_gl-0.0.3\android\src\main\java\com\mapbox\mapboxgl\MapboxMapController.java:286: ����: �Ҳ�������
    public void onStyleLoaded(@NonNull Style style) {
                               ^
  ����: �� NonNull
ע: ijЩ�����ļ�ʹ�û򸲸����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: ijЩ�����ļ�ʹ����δ�����򲻰�ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
8 ������

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mapbox_gl:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 56s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1

i can run example without error。

but when i run my project,i get an error.

thanks for any help.

iconColor has no effect.

title and location works but anchors colors properties has no effect.
are there just a dummy properties or there are some tricks we have misunderstood ?

_controller.addSymbol(SymbolOptions(
      geometry: l,
      textField: title,
      textAnchor: "top",
      iconImage: "grocery-15",
      zIndex: 7,
      iconColor: "#ff0000",
      iconAnchor: "bottom",
      iconSize: 2,
    ));

Example app crashes when building using flutter build apk on 64 bit devices.

Running flutter build apk and then flutter install builds the apk and installs it on the device. However, running the app results in a crash on 64bit devices.

This happens because the Flutter builder doesn't include libflutter.so for all ABIs. Inspecting the apk file can be done by dragging the apk onto Android Studio. As can be seen in the picture, only the armeabi-v7a directory has both libmapbox-gl.so and libflutter.so.

Screen Shot 2019-03-24 at 12 02 24

A temporary workaround can be done by adding the following to the app/build.gradle

defaultConfig {
...
ndk { abiFilters 'armeabi-v7a' }
}

This builds only the 32bit ARM abi. However, this is not the right way to do it, and Google stated it'll force 64bit support for APKs on the Play Store starting from this summer. This also causes crash on my device when debugging the app.

Get CI setup

We should add continuous integration that is run for each PR. Initial setup should just verify if the code can be build. Further iterations could add running tests, static code analysis and perform automated releases.

@yoavrofe

Example app refactor

To support showcasing more APIs to the example project, we should refactor the app so we can easily show more examples. In the Android test app of gl-native, we show a list of example screens as first page of the app.

image

Drawing hexes and updating them based on location

Hi! I just found this plugin, and I'm a total beginner in Flutter, so please bear with me.

I'm looking to achieve two things and would like to know whether they are currently achievable with this plugin (or in conjunction with it):

  1. Draw invisible hex tiles over the map (covering the whole world, or at least part of it for now)
  2. As user's GPS location is updated, turn each hex they go through visible and fill it with semi transparent color

How would I go about doing it? Any pointers would be very helpful.

Replace Marker/Annotations API with annotations plugin

Our current SDK setup and API defintion was migrated from Google Maps Flutter plugin through https://github.com/AmudAnan/mapbox_from_google_maps/. That codebase use Markers and other components that match what is found in the annotations package on the Mapbox Maps SDK for Android. However this API has been deprecated since v7.0.0 in favor of using the annotation plugin in https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.