nativescript-mapbox: NullPointerException when running on Android
Hey @EddyVerbruggen,
Just tried out the plugin and it works great on iOS, but I’m getting the following error on Android:
JS: Error in mapbox.show: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
JS: android.view.ViewConfiguration.get(ViewConfiguration.java:359)
JS: android.view.View.<init>(View.java:3587)
JS: android.view.View.<init>(View.java:3682)
JS: android.view.ViewGroup.<init>(ViewGroup.java:497)
JS: android.view.ViewGroup.<init>(ViewGroup.java:493)
JS: android.view.ViewGroup.<init>(ViewGroup.java:489)
JS: android.view.ViewGroup.<init>(ViewGroup.java:485)
JS: android.widget.FrameLayout.<init>(FrameLayout.java:103)
JS: com.mapbox.mapboxsdk.views.MapView.<init>(MapView.java:685)
Any idea what’s up? I’m testing on an Android 5.x emulator and I have showUserLocation turned off. Here’s the code I’m using:
mapbox.show({
accessToken: "---MY TOKEN---",
style: mapbox.MapStyle.EMERALD,
margins: {
left: 0,
right: 0,
top: 0,
bottom: 300
},
showUserLocation: false,
hideAttribution: true,
hideLogo: true,
hideCompass: true
});
Thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22
Commits related to this issue
- #3 NullPointerException when running on Android — committed to Yermo/nativescript-mapbox by EddyVerbruggen 8 years ago
- NullPointerException when running on Android #3 — committed to Yermo/nativescript-mapbox by EddyVerbruggen 8 years ago
- #3 NullPointerException when running on Android — committed to Yermo/nativescript-mapbox by EddyVerbruggen 8 years ago
- NullPointerException when running on Android #3 — committed to Yermo/nativescript-mapbox by EddyVerbruggen 8 years ago
@MikeHuntington To my knowledge there are no updates, but the
setTimeout()workaround has been working fine for me. Essentially the code is something like this:You can show an activity indicator or something in the time it takes to load the map if the delay is awkward.
@Stavanger75 about to push an update that handles this delay automatically.