Black screen, not show the map
When I try to open the map, the screen goes black, and never the map is displayed. I tried doing a new application in Android Studio and I downloaded the demo of the Play Store, I have the same problem in both applications. I'm working on Android version 4.2.2.

@LuisBotero: Could you add the code where you are initializing the map? Can you verify that you are calling the different lifecycle methods?
Linking issue (#2513) with same problem. @bleege @ljbade @zugaldia
The code are calling the different lifecycle methods correctly, onCreate, onStart, onResume, etc There are some screenshots of my code, the activity_main and MainActivity classes, and also attached some results in the Logcat console when I open my application. The code used is like the example of the documentacion in the website of MapBox Android API.

@LuisBotero this is great info to have, thank you for that!
@LuisBotero Can you try https://github.com/mapbox/mapbox-gl-native/pull/2810 to see if it fixes this issue?
@ljbade I'm still having the same problem, the map is not displayed, I tried with versions 2.1.0 and 2.2.0 of MapBox and none have worked for me. I need to do something extra in my code?
@LuisBotero: @ljbade indicated building from source. A new SNAPSHOT, that you can use as a gradle dependency, will be released later today. Would be awesome if you could test again with that. Will ping you if that SNAPSHOT lands.
@LuisBotero We just released a new SNAPSHOT from our testing in #2817. Please feel free to give it a shot to make sure we were able to solve the problem. Instructions on how to install it are available at https://www.mapbox.com/android-sdk/#gradle.
Thanks again for reporting this issue and for using the SDK!
@bleege I'm still having trouble running my code. The map still shows black screen on my phone and the AVD stops working when I run my application with the map.
This is my build.gradle

This is what I get in my xml

And this is my class.

Am i doing something wrong?. Why my map does not work? I'm working with Android 4.2.2 in the AVD and on my phone. Thank you for your help!!
@LuisBotero
Thank you for sharing your code, I have created a separate project to test this in, I copied your code and loaded it up on a nexus 5 emulator running 4.2.2:

It seems that your Gradle is not using the newer version of the SNAPSHOT but rather a cached one. The results you are describing are the same as before the fix of @ljbade for 4.x devices .
Could you try doing a sync gradle with project files?
Do you see anything in the logging while running?
@LuisBotero I created an issue for the layout editor bug in https://github.com/mapbox/mapbox-gl-native/issues/2830
~~What happens if you move mapView.onCreate() above the mapView.set... lines?~~ @tobrun beat me to it, looks like it should work.
@LuisBotero Thanks for testing it out. A couple of things to try:
- Swap the line order of
mavenCentral()andmaven { url: ""} - Try is to do a force update of the Gradle dependency in the command line while Android Studio is closed and then reopen it so that Android Studio picks up all the changes. I know that's kinda lame, but I've noticed this before.
To force dependency updates:
cd mapbox-gl-native/android/
./gradlew clean --refresh-dependencies
I have the same issue. Bleege, tried your instructions but no luck.
@LuisBotero @ernest95 Thanks for trying to test the SNAPSHOT. I created a simple app (see link below) that shows how to add the SNAPSHOT to an app. Hopefully this helps!
https://github.com/bleege/MapboxSnapshot
I'm still having these issue. It works on genymotion virtual devices but shows black screen on all android devices.
@tobrun @ljbade @bleege Thank you very much for your help. The code is working for me and running fine.

Awesome @LuisBotero! Thanks again for bringing this to our attention so that we could fix it. We really appreciate it! :rocket: :rocket:
Hi have a black screen after execute
CameraPosition.Builder cameraPosition = new CameraPosition.Builder() .target(position.toBoxLatLng()) .bearing(bearing).tilt(90); if(!isZoomed){ cameraPosition.zoom(16); } isZoomed = true; map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition.build()), 25000, null);
Using com.mapbox.mapboxsdk:mapbox-android-sdk:3.2.0@aar
Hello,
I had the same problem, I saw the comment of Pasha0093
I noticed that I was using a "animateCamera" in my onCreate() :
using : com.mapbox.mapboxsdk:mapbox-android-sdk:3.2.0@aar
cameraPosition = new CameraPosition.Builder()
.target(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()))
.zoom(currentZoom)
.tilt(70)
.bearing(0)
.build();
mapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 5000, null);
I deleted this animateCamera in my onCreate() and after that I did not have black screen
But also I use animateCamera for each new location of user (I've not delete it)
@Override
public void onResume() {
IntentFilter filterIntent = new IntentFilter(Constantes.BROADCAST_LOCATION_FILTER);
bcReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras(); // on recup. le bundle
Location temp = (Location) extras.get("NEW_LOCATION");
[..]
updateMap(userPos.getLatitude(),userPos.getLongitude(),orientationCamera);
}
};
}
private void updateMap(double latitude, double longitude, float orientCam) {
currentZoom = calculZoom();
markerUser.position(new LatLng(latitude, longitude));
cameraPosition = new CameraPosition.Builder()
.target(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()))
.zoom(currentZoom)// currentZoom
.tilt(70)
.bearing(orientCam)
.build();
mapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 5000, null);
}
try move camera but it is without animation , about snapshot i cant integrate it in my project
mapView.moveCamera