-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
remove marker: Attempt to invoke virtual method 'void com.google.android.gms.maps.model.setIcon(com.google.android.gms.maps.model.BitmapDescription)' on a null object reference #2507
Comments
I am having the exact same problem when trying to customise my marker icons. Icons are customized this way:
The issue goes away after removing the View + Icon children and leaving it as default icon. |
in AirMapMarker.java from package, say:
so, you need add tracksViewChanges and setting to false, into
This worked for me. I hope for you too. |
I've encountered similar issue and no idea of the right solution. Please help.
|
i'm getting this issue too using "react": "16.4.1", "react-native": "0.56.0" and using react-native-maps from master only when using ** tracksViewChanges**, turn it off seems to solve the problem but then marker can no longer update changes |
Also experienced this problem on Android, RN |
The PR fixed the problem for me at least. Is there a timeline when this could get merged and published? |
Thank you for the feedback. Is the any chance to make a release soon? |
i checkedout this fix and it solved the above error but now i get an other error: |
Same issue here, tried the changes by @salah-ghanim , but in my opinion it makes nothing else than setting tracksViewChanges to false. And then we have the case that the markers will not update. When I set tracksViewChanges to false, my map will not show any markers on start. They will first appear when I zoom into the map. "react-native-maps": "^0.22.0",
"react": "16.5.0",
"react-native": "0.57.1", MarkerCode const ClusterMarker = ({ coordinate, width, height, image, count, tracksViewChanges }) => {
return (
<Marker coordinate={coordinate} tracksViewChanges={tracksViewChanges}>
<Image width={width} height={height} image={image} asset/>
<TextWrapper>
<ClusterText>{count}</ClusterText>
</TextWrapper>
</Marker>
)
}
const MultiMarker = ({ coordinate, width, height, image, count, tracksViewChanges }) => {
return (
<Marker coordinate={coordinate} tracksViewChanges={tracksViewChanges}>
<Image width={width} height={height} image={image} asset/>
<TextWrapper>
<MarkerText>{count}</MarkerText>
</TextWrapper>
</Marker>
)
}
const EntityMarker = ({ coordinate, width, height, entity, tracksViewChanges }) => {
return MARKER_IMAGES[entity] ?
<Marker coordinate={coordinate} tracksViewChanges={tracksViewChanges}>
<Image width={width} height={height} image={MARKER_IMAGES[entity]} asset/>
</Marker> : null
} MapViewSnippet <MapView
// provider={PROVIDER_GOOGLE}
style={[ styles.container, { height: this.state.mapHeight }]}
initialRegion={{...region, ...DEFAULT_DELTA}}
onRegionChangeComplete={calcBounds}
>
{
!hideRadius &&
<Circle
center={home}
radius={currentUser && currentUser.config && currentUser.config.radius && currentUser.config.radius.distance || 10000 }
fillColor={theme.colors.mapRadius}
strokeColor={theme.colors.mapRadius}
strokeWidth={theme.measures.strokeWidth}
/>
}
{home && <HomeMarker coordinate={home} />}
{
clusters.map((cluster, index) =>
!cluster.poi ?
<ClusterMarker
key={cluster.id}
count={cluster.properties.point_count}
coordinate={{ latitude: cluster.geometry.coordinates[1], longitude: cluster.geometry.coordinates[0] }}
tracksViewChanges={tracksViewChanges}
/>
: (
cluster.markerID && cluster.properties.point_count > 1 ?
<MultiMarker
key={cluster.markerID}
coordinate={{ latitude: cluster.geometry.coordinates[1], longitude: cluster.geometry.coordinates[0] }}
count={cluster.properties.point_count}
tracksViewChanges={tracksViewChanges}
/> :
<EntityMarker
key={cluster.poi.id}
coordinate={{ latitude: cluster.geometry.coordinates[1], longitude: cluster.geometry.coordinates[0] }}
entity={cluster.poi.type}
tracksViewChanges={tracksViewChanges}
/>
)
)
}
</MapView> |
That PR solved my issue, thanks |
That PR solves it for me too. Any idea when this will be released? I am now pinned on a master commit. |
I have the same error. I am using react-native-maps-super-cluster module and it appears when using a custom marker view. It was not easy for me to find this issue, therefore I am also adding the stacktrace here:
|
@ZeroCool-85 my changes only do a nullability check. they shouldn't affect any logic in the react-native-maps APIs as for the crash you're receiving it might have something to do with the way the clustering library handles annotations, If that's your case (you're using a clustering library) I'd suggest you open an issue there. |
I am getting the same error on React Native Maps
I updated to the new version of Expo today Here is what my <MapView.Marker
onPress={select_marker}
stopPropagation={true}
style={{
zIndex: z_index,
}}
coordinate={{
latitude: vehicle.latitude,
longitude: vehicle.longitude,
}}
>
<Image
source={source}
style={style}
/>
</MapView.Marker> expo/expo#2680 mentions that it should fix this issue. But I am still seeing the problem. Any advice on how I can troubleshoot this? cc @sjchmiela and @tsapeta |
Could you also please ensure you’re testing the behavior with the latest Expo Client (v2.9.2)? It has been 5 hours ago to the Play Store and it is the only version that contains the bugfix. 😊 |
@sjchmiela updated to the new Expo client and it's working now! For others, I upgraded by uninstalling Expo on my simulator and reinstalling it via the Expo CLI. Thanks so much for all of your hard work. I didn't realize that the Expo client packaged in the Expo code. I assumed it was coming from my node modules (which had the correct version of Expo RNM). Is there anything I can read to help my understanding of the architecture of Expo / React Native? |
Hm… 🤔 This looks like a simple starter when it comes to Expo architecture in general — How Expo Works. Apart from that: One Expo Client app lets you run experiences with multiple different SDK versions. If so, we need to be able to package multiple SDK environments in one codebase. To achieve that, we keep track of two sets of environments:
To be able to compile all this in a single application (with unique class names as a requirement), we prefix class names (on Android we add Every Expo SDK release depends on different sets of external libraries (we pulled in not only
Apart from code that is subject to versioning there is also code that isn't versioned, sort of an entrypoint to the application, which binds these different environments. I won't explain it in much detail as the details aren't important to the discussed aspect of Expo, if you want, you can find it in When you run your experience with Expo Client, kernel fetches the manifest from your computer, checks requested I hope I've lifted the veil of secrecy at least a little bit. 🙂 |
Can you please provide the complete code? <MapView style={ styles.mapView } |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I've used react-native-maps in my project. It was working fine. then I added some new components to project, suddenly when I remove custom markers from map, red screen appears:
error:
Attempt to invoke virtual method 'void com.google.android.gms.maps.model.setIcon(com.google.android.gms.maps.model.BitmapDescription)' on a null object reference.
my package.json:
this is the usage of custom marker in the map:
when user pan on the map, markers will render.
The text was updated successfully, but these errors were encountered: