Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor addStyleImage function #879

Open
Brez18 opened this issue Feb 28, 2025 · 1 comment
Open

Refactor addStyleImage function #879

Brez18 opened this issue Feb 28, 2025 · 1 comment

Comments

@Brez18
Copy link

Brez18 commented Feb 28, 2025

I get this Platform Exception whenever i try to add an styleImage using the style.addStyleImage() function:
This is the log dump

E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): Failed to handle message
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap$Config android.graphics.Bitmap.getConfig()' on a null object reference
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.mapbox.maps.mapbox_maps.StyleController.addStyleImage(StyleController.kt:611)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.mapbox.maps.mapbox_maps.pigeons.StyleManager$Companion.setUp$lambda$93$lambda$92(MapInterfaces.kt:6573)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.mapbox.maps.mapbox_maps.pigeons.StyleManager$Companion.$r8$lambda$lRvnrb64UZK1xwpPleLL6Q0pCMo(Unknown Source:0)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.mapbox.maps.mapbox_maps.pigeons.StyleManager$Companion$$ExternalSyntheticLambda34.onMessage(Unknown Source:2)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at android.os.Handler.handleCallback(Handler.java:959)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at android.os.Looper.loopOnce(Looper.java:282)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at android.os.Looper.loop(Looper.java:387)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at android.app.ActivityThread.main(ActivityThread.java:9505)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at java.lang.reflect.Method.invoke(Native Method)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
E/BasicMessageChannel#dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0(24833): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1005)
E/flutter (24833): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0"., null, null)
E/flutter (24833): #0      StyleManager.addStyleImage (package:mapbox_maps_flutter/src/pigeons/map_interfaces.dart:7142:7)```
@Brez18 Brez18 changed the title PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage.0"., null, null) Refactor addStyleImage function Mar 1, 2025
@Brez18
Copy link
Author

Brez18 commented Mar 1, 2025

So i was able to rectify the problems i was having but in the process i found some issues with the addStyleImage function

  • So firstly one of the problems came from a param which is a List<ImageStretches?>, according to this [null] can be passed as an arg but when this is done it produces a NullPointerException at line 626 in the StyleController.kt.
  • The other problem is the param scale, when i tried to increase the scale value the symbol would reduce in size and when scale value was decreased the size would increase which i believe is the complete opposite.

@Brez18 Brez18 changed the title Refactor addStyleImage function Refactor 'addStyleImage' function Mar 1, 2025
@Brez18 Brez18 changed the title Refactor 'addStyleImage' function Refactor addStyleImage function Mar 1, 2025
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

No branches or pull requests

1 participant