Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

addImage bug in v7.0.12 for android

Abierto
#118 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
android, typescript
Área
mobile-dev

Línea de trabajo

Comienza en @nativescript-community/ui-mapbox/index.android.js, centrándote en addImage y su llamada a fetchImageSource. Compara la API style-image actual del Mapbox Android SDK v11 con la invocación directa de addImage y verifica el comportamiento corregido frente al NoSuchMethodError informado. Se considera terminado cuando se puedan añadir imágenes en Android sin el fallo por la firma.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hello, first thank you very much for upgrading the library. The nativescript community is amazing and very glad to see it constantly evolve and being maintained.

I think I found a bug. The contract changed slightly with mapbox sdk v11+ in Android for addImage as it seems its expecting to be wrapped by a ImageExtensionImpl builder before providing the image.

Therefore I was getting this error when trying to add an image in mapbox sdk

Error: java.lang.NoSuchMethodError: no static method "Lcom/mapbox/maps/MapboxStyleManager;.addImage(Ljava/lang/String;Landroid/graphics/Bitmap;)Lcom/mapbox/bindgen/Expected;

After debugging the problem I figured out reading the very clear documentation about the migration (this was a sarcasm of course)

I could not find any other reference that properly cast the image it seems like

style.addImage('id', imageBitMap)

should be supported but in my case it looks like the signature did not match thus crashed consistently.

So I got a proposition to fix this issue from reverse engeneering the implementation but I suspect this is not the proper way.

@nativescript-community/ui-mapbox/index.android.js

In addImage I changed :

const imageSource = await this.fetchImageSource(imagePath);
theMap.getStyle().addImage(imageId, imageSource.android);

To

const imageSource = await this.fetchImageSource(imagePath);
const bitmap = imageSource.android;

const ImageExtensionImpl = com.mapbox.maps.extension.style.image.ImageExtensionImpl;
const imageBuilder = new ImageExtensionImpl.Builder(imageId, bitmap);
const image = imageBuilder.build();

image.bindTo(theMap.getStyle());

resolve();

making sure that the bitmap is properly casted.

If anyone has a better solution or if I am totally mistaken let me know thank you.

Lenguaje dominante
TypeScript
Estrellas
38
Forks
26
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nativescript-community/ui-mapbox

Todos los issues de nativescript-community/ui-mapbox

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.