-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Android crashes on startup #2995
Comments
Some more info:
|
@iCyberon Can you see if you can find the native stack trace. In logcat change the "Show only selected application" to "No filter" In the search box put "DEBUG" |
The same on Samsung Galaxy Tab 3 7.0, Android 4.2.2. This seems to be the origin of the error
|
I'm getting the same error 3008 (EGL_BAD_DISPLAY) in eglCreateWindowSurface when creating a MapView on these devices:
Totally blocked right now... :( |
I think this only happens on tablets. |
Attaching some relevant debug log info from the Kindle Fire HD after enabling OpenGL traces (logcat) in Developer Options. From Xamarin Studio debugger's Application Output window: Logcat details from DDMS: |
@iCyberon, possible -- all my previous tests above were tablets. However, I just tried it on VS Android Emulator 5.5" XXHPDI Phone running Android 5.1.1 (similar to LG G4) and got the same error. |
@bmeyers43 It's related to DPI I guess. http://forum.xda-developers.com/showthread.php?t=2212632 |
Maybe...that bug was happening in eglSwapBuffers, but we're seeing it in eglCreateWindowSurface. Also, the Fire HD reports 216 dpi, while the VS Emulator images both claim to be 323 dpi, so I'm not sure what values/ranges would lead to this error. |
on x86 architecture using Genymotion and latest SNAPSHOT, I was able to:
Note: I was able to run on 4.2.2 wiht ARM without a problem |
Never mind, by bad :-) |
@tobrun, since you are able to repro on at least some devices now, when do you think this will get assigned/fixed? |
Looking into this: Used following build command:
I'm getting following recurring stacktraces: Result after symbolicating: The reference of NativeMapView InitializeDisplay in JNI refers to this void JNICALL nativeInitializeDisplay(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeInitializeDisplay");
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
try
{
nativeMapView->initializeDisplay();
} catch(const std::exception& e) {
throw_jni_error(env, "Unable to initialize GL display.");
}
} That will call the underlying code in native_map_view.cpp: void NativeMapView::initializeDisplay() {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::initializeDisplay");
assert(display == EGL_NO_DISPLAY);
assert(config == nullptr);
assert(format < 0);
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglGetDisplay() returned error %d", eglGetError());
throw new std::runtime_error("eglGetDisplay() failed");
}
EGLint major, minor;
if (!eglInitialize(display, &major, &minor)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglInitialize() returned error %d", eglGetError());
throw new std::runtime_error("eglInitialize() failed");
}
if ((major <= 1) && (minor < 3)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "EGL version is too low, need 1.3, got %d.%d", major,
minor);
throw new std::runtime_error("EGL version is too low");
}
log_egl_string(display, EGL_VENDOR, "Vendor");
log_egl_string(display, EGL_VERSION, "Version");
log_egl_string(display, EGL_CLIENT_APIS, "Client APIs");
log_egl_string(display, EGL_EXTENSIONS, "Client Extensions");
// Detect if we are in emulator
if (inEmulator()) {
mbgl::Log::Warning(mbgl::Event::Android, "In emulator! Enabling hacks :-(");
}
// Get all configs at least RGB 565 with 16 depth and 8 stencil
EGLint configAttribs[] = {
EGL_CONFIG_CAVEAT, EGL_NONE, EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BUFFER_SIZE, 16, EGL_RED_SIZE,
5, EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5, EGL_DEPTH_SIZE,
16, EGL_STENCIL_SIZE, 8,
(inEmulator() ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT, // Ugly hack
(inEmulator() ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER, // Ugly hack
EGL_NONE};
EGLint numConfigs;
if (!eglChooseConfig(display, configAttribs, nullptr, 0, &numConfigs)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig(NULL) returned error %d",
eglGetError());
throw new std::runtime_error("eglChooseConfig() failed");
}
if (numConfigs < 1) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig() returned no configs.");
throw new std::runtime_error("eglChooseConfig() failed");
}
const auto configs = std::make_unique<EGLConfig[]>(numConfigs);
if (!eglChooseConfig(display, configAttribs, configs.get(), numConfigs, &numConfigs)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig() returned error %d", eglGetError());
throw new std::runtime_error("eglChooseConfig() failed");
}
config = chooseConfig(configs.get(), numConfigs);
if (config == nullptr) {
mbgl::Log::Error(mbgl::Event::OpenGL, "No config chosen");
throw new std::runtime_error("No config chosen");
}
if (!eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglGetConfigAttrib() returned error %d",
eglGetError());
throw new std::runtime_error("eglGetConfigAttrib() failed");
}
mbgl::Log::Info(mbgl::Event::OpenGL, "Chosen window format is %d", format);
} |
A difference I'm noticing between the working genymotion images versus non-working are the GL version: Not working logs:
Working logs:
Also I found this #573 from @ljbade, |
I'm putting above as a works as designed, the SDK requires a minimum version of |
After investigating my startup crash I'm back at square one. @iCyberon, @vkurchatkin: Could you add the stack trace @ljbade requested? @bmeyers43: I stumbled on your thread on the Xamarin forums. Since this is not working on any devices for you, I believe something else is going wrong. Is it possible that you are not hooking into the required lifecycle methods as shown here? Thank you in advance, |
Here it goes: https://gist.github.com/vkurchatkin/1652ed747de48721ae80 |
Thank you, this is the result after symbolicating the crash:
/cc @zugaldia |
@tobrun but doesn't it happen AFTER |
@vkurchatkin I believe you are right,
From Romain Guy:
It could also be that the GPU you are using on tablets does not support shared context. |
does this mean that nothing can be done about it? |
@tobrun ping. (sorry for being annoying) |
@vkurchatkin no issue! I really want to get to the bottom of this. |
@tobrun I can reproduce the issue with MapboxGLAndroidSDKTestApp |
@tobrun, my fault, you're right -- calling OnCreate() eliminated the EGL_BAD_DISPLAY error in my case. It would be nice if some code inside the Mapbox SDK checked the state initialized by OnCreate before calling eglCreateWindowSurface, and throw a more helpful error if that state has not been initialized yet. |
+1 here!
|
@tobrun Hi! I've managed to run Test App applying the following changes: diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index d32f3c8..b15997b 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -429,6 +429,12 @@ void NativeMapView::createSurface(ANativeWindow *window_) {
oldDisplay = display;
}
+ if (!eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
+ mbgl::Log::Error(mbgl::Event::OpenGL,
+ "eglMakeCurrent(EGL_NO_CONTEXT) returned error %d", eglGetError());
+ throw new std::runtime_error("eglMakeCurrent() failed");
+ }
+
if (!eglMakeCurrent(oldDisplay, oldDrawSurface, oldReadSurface, oldContext)) {
mbgl::Log::Error(mbgl::Event::OpenGL,
"eglMakeCurrent(EGL_NO_CONTEXT) returned error %d", eglGetError()); I have literally 0 knowledge of OpenGL, so I can't fully explain what's going on, but it seems I hope this is useful. |
/cc @jfirebaugh @kkaefer |
@vkurchatkin with that code in place you are able to run on a device that initially gave crashes? |
@tobrun yep, it seems that all features work as expected |
Getting the same issue with the plain Mapbox Android SDK 10-25 23:16:35.504 2444-2444/? E/mbgl: [Shader]: Shader failed to compile: ERROR: Valid GLSL but not GLSL ES |
note - happens on all RemixOS, likely all Android_x86 |
@uudruid74 Thanks for the report. What version of the Mapbox Android SDK, the Android OS, and which devices are you using? Thanks! |
I'm also experiencing Additional information:
|
Same issue in #6400 |
@zugdalia: Latest RemixOS based on Marshmallow (6.0.1) - identicle OSs, different CPUs (both x86_64) and different graphics drivers. Two are laptops, one an Asus X200CA - Intel/Ivybridge graphics. The other an HP with an AMD A8-4555M (Radeon graphics using Gallium driver). These are both OpenGL 3.0 ES compliant (and below). Also have got the same exact error from the Android Studio emulator on the same HP/AMD system under Antergos/Linux. The SDK is actually spelled out in the dump above in the last line. It seems to be an issue with the #define lines (compile on demand maybe? llvm?). Looks like there may have been a resolution in Issue #7044 I've not seen if a newer SDK has been released or what. |
@uudruid74 the fix from #7044 will fix running on x86. This fix will be included in the following beta5 release of 4.2.0. We are aiming at releasing that today in #7047. |
mapboxsdk:mapbox-android-sdk Version 5.0.2@aar crashes at startup on Genymotion
|
@Max01010101010101 Do you have more details about the used image? |
Hi @tobrun |
Same error if anyone knows the solution than let me know . |
@NancyAndroid Which version of the SDK are you using? Is this error only occurring within Genymotion? |
I am getting this in logcat will tring to enter the data to Firebase database? 1-14 17:19:58.570 10301-10323/com.example.hp.billingapp D/EGL_emulation: eglMakeCurrent: 0xb4332940: ver 2 0 |
@Bbunty Could you clarify which version of the SDK are you using and if this error is only occurring within Genymotion? is it making your app crash? |
Hey guys,
Looks like mapbox crashes for some devices on start.
Device: Samsung Galaxy Tab Pro 8.4 3G/LTE
Android Version: 4.2.2
The text was updated successfully, but these errors were encountered: