Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Android: eglCreateWindowSurface() failed in Fragment #9593

Closed
nscherer opened this issue Jul 24, 2017 · 3 comments
Closed

Android: eglCreateWindowSurface() failed in Fragment #9593

nscherer opened this issue Jul 24, 2017 · 3 comments
Labels
Android Mapbox Maps SDK for Android support

Comments

@nscherer
Copy link

When using a MapView from an activity, it works fine. From a Fragment within an Activity, it crashes. The stack trace is below.

Project: https://u76707225.dl.dropboxusercontent.com/u/76707225/MapBox.zip

Platform: Android Lollipop
Mapbox SDK version: 5.1.0

Steps to trigger behavior

  1. Run the app

Expected behavior

A map is displayed

Actual behavior

FATAL EXCEPTION: main
Process: com.example.mapbox, PID: 31725
java.lang.Error: eglCreateWindowSurface() failed
at com.mapbox.mapboxsdk.maps.NativeMapView.nativeCreateSurface(Native Method)
at com.mapbox.mapboxsdk.maps.NativeMapView.createSurface(NativeMapView.java:158)
at com.mapbox.mapboxsdk.maps.MapView$SurfaceCallback.surfaceCreated(MapView.java:427)
at android.view.SurfaceView.updateWindow(SurfaceView.java:666)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:199)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:921)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2210)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1230)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6726)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

@Guardiola31337 Guardiola31337 added the Android Mapbox Maps SDK for Android label Jul 24, 2017
@tobrun
Copy link
Member

tobrun commented Jul 25, 2017

Can you restest with 5.1.1? This version included some fixes related to egl context switching

@tobrun
Copy link
Member

tobrun commented Jul 25, 2017

Thank you for adding the sample code, I was able to figure it out:

  • you are calling onCreate twice in onCreateView, this is not allowed
  • on top of this, you need to move mMapView.onDestroy to onDestroyView instead

@tobrun tobrun closed this as completed Jul 25, 2017
@tobrun tobrun added the support label Jul 25, 2017
@nscherer
Copy link
Author

Thank you very much, some combination of switching to 5.1.1 and removing the extra onCreate call fixed it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android support
Projects
None yet
Development

No branches or pull requests

3 participants