NullPointerException when running on Android
See original GitHub issueHey @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.
Issue Analytics
- State:
- Created 8 years ago
- Comments:22
Top Results From Across the Web
How to solve NullPointerException error in Android?
NullPointerException means that mp is null. This means the MediaPlayer.create() failed. Does R.raw.alarm exist?
Read more >NullPointerException - Android Developers
NullPointerException objects may be constructed by the virtual machine as if stack trace was ... Constructs a NullPointerException with no detail message.
Read more >Frequent NullPointerException when running Android ...
The exception stack suggests this error is occurring because the layout resource does not contain expected elements, which is consistent with corruption of...
Read more >NullPointerException after app launch fails in Android Emulator
I tried to run a Flutter app in the Android Emulator (Pixel 4 API 30), but that failed with a "Lost connection to...
Read more >Android Studio NullPointerException in ... - Issue Tracker
I'm running Android Studio 0.3.5 and I'm constantly getting a NullPointerException whenever I click my run config to build and run my app....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.