mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
288 stars 119 forks source link

Error when use MapboxOptions.setAccessToken('xxxxxx') #387

Open dhaq opened 9 months ago

dhaq commented 9 months ago

No implementation found for void com.mapbox.common.MapboxOptionsImpl.setAccessToken(java.lang.String) (tried Java_com_mapbox_common_MapboxOptionsImpl_setAccessToken and Java_com_mapbox_common_MapboxOptionsImpl_setAccessTokenLjava_lang_String_2) - is the library loaded, e.g. System.loadLibrary? 2024-02-01 09:08:43.024 27242-27371 flutter com.mapbox.maps.flutter.example E [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(java.lang.UnsatisfiedLinkError: No implementation found for void com.mapbox.common.MapboxOptionsImpl.setAccessToken(java.lang.String) (tried Java_com_mapbox_common_MapboxOptionsImpl_setAccessToken and Java_com_mapbox_common_MapboxOptionsImpl_setAccessToken__Ljava_lang_String_2) - is the library loaded, e.g. System.loadLibrary?, UnsatisfiedLinkError, Cause: null, Stacktrace: java.lang.UnsatisfiedLinkError: No implementation found for void com.mapbox.common.MapboxOptionsImpl.setAccessToken(java.lang.String) (tried Java_com_mapbox_common_MapboxOptionsImpl_setAccessToken and Java_com_mapbox_common_MapboxOptionsImpl_setAccessTokenLjava_lang_String_2) - is the library loaded, e.g. System.loadLibrary? at com.mapbox.common.MapboxOptionsImpl.setAccessToken(Native Method) at com.mapbox.common.MapboxOptions.setAccessToken(MapboxOptions.kt:23) at com.mapbox.maps.mapbox_maps.MapboxOptionsController.setAccessToken(MapboxOptionsController.kt:13) at com.mapbox.maps.pigeons.FLTMapInterfaces$_MapboxOptions.lambda$setUp$1(FLTMapInterfaces.java:8012) at com.mapbox.maps.pigeons.FLTMapInterfaces$_MapboxOptions$$ExternalSyntheticLambda1.onMessage(Unknown Source:2) at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:219) at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8762) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) , null)

0 _MapboxOptions.setAccessToken (package:mapbox_maps_flutter/src/pigeons/map_interfaces.dart:4921:7)

                                                                                                <asynchronous suspension>
evil159 commented 9 months ago

@dhaq Do you pass access token early in the app lifecycle? It could be that flutter widget bindings are not initialized yet and you should invoke WidgetsFlutterBinding.ensureInitialized() before setting the token.

anjana1904 commented 7 months ago

I'm facing the same issue. Does anyone have a solution for it?

nikhilsingh834783 commented 7 months ago

@dhaq have you found any solutions for it?