googlemaps / react-native-navigation-sdk

React Native library (Beta) for bringing Google Navigation SDK to Android and iOS apps using React.
https://www.npmjs.com/package/@googlemaps/react-native-navigation-sdk
Apache License 2.0
34 stars 7 forks source link

Failed to decode image. The provided image must be a Bitmap #346

Closed xiaobc1234 closed 6 days ago

xiaobc1234 commented 1 week ago

Thanks for stopping by to let us know something could be better!

Please be sure to include as much information as possible:

Environment details

System: OS: macOS 14.2.1 CPU: (10) arm64 Apple M1 Pro Memory: 108.23 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.13.0 path: /usr/local/bin/node Yarn: version: 1.22.17 path: /usr/local/bin/yarn npm: version: 10.5.2 path: /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.15.2 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

@googlemaps/react-native-navigation-sdk : 0.8.1

Steps to reproduce

When adding a Marker in MapView, how should the imgPath parameter be passed?

Reference #33

Code example

# example

      mapViewController?.addMarker({
          position: {
            lat: DefaultPoint.lat,
            lng: DefaultPoint.lng,
          },
          // imgPath: require("../../../assets/images/pointEnd.png"),
          // imgPath: require("../../../assets/images/pointEnd.bmp"),
          // imgPath: "../../../assets/images/pointEnd.bmp",
          // imgPath: "../../../assets/images/pointEnd.png",
          imgPath:
            "https://xxx.com/imgextra/i4/O1CN017xSn9K1tq4OZj0esx_!!6000000005952-3-tps-20-33.bmp",
          // imgPath: startImage,
          title: "test point",
          snippet: "test point desc",
          draggable: true,
        })

       <MapView
        style={styles.map_view}
        mapViewCallbacks={baseMapViewCallbacks}
        onMapViewControllerCreated={setMapViewController}
      />

Stack trace

# example

 ERROR  Your app just crashed. See the error below.
com.google.maps.api.android.lib6.common.apiexception.ApiIllegalArgumentException: Failed to decode image. The provided image must be a Bitmap.
  com.google.android.libraries.navigation.internal.aae.t.a(PG:2)
  com.google.android.libraries.navigation.internal.aae.z.a(PG:4)
  com.google.android.libraries.navigation.internal.aae.ew.<init>(PG:8)
  com.google.android.libraries.navigation.internal.aae.ey.b(PG:5)
  com.google.android.libraries.navigation.internal.aae.ch.k(PG:8)
  com.google.android.gms.maps.GoogleMap.addMarker(PG:1)
  com.google.android.react.navsdk.MapViewController.addMarker(MapViewController.java:168)
  com.google.android.react.navsdk.NavViewModule.lambda$addMarker$4(NavViewModule.java:168)
  com.google.android.react.navsdk.NavViewModule.$r8$lambda$lrjNM_vSvUdffACylQMh60fKs7Y(Unknown Source:0)
  com.google.android.react.navsdk.NavViewModule$$ExternalSyntheticLambda6.run(Unknown Source:8)
  android.os.Handler.handleCallback(Handler.java:942)
  android.os.Handler.dispatchMessage(Handler.java:99)
  android.os.Looper.loopOnce(Looper.java:201)
  android.os.Looper.loop(Looper.java:288)
  android.app.ActivityThread.main(ActivityThread.java:7872)
  java.lang.reflect.Method.invoke(Native Method)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Following these steps will guarantee the quickest resolution possible.

Thanks!