Skip to content

Crash: GLSurfaceView IllegalStateException: setRenderer has already been called for this instance #518

@yanickv

Description

@yanickv

Description

GLSurfaceView IllegalStateException: setRenderer has already been called for this instance. Happens on line 211 of MapController.js (in call to view.setRenderer(this))

protected MapController(GLSurfaceView view) {
    // Set up MapView
    mapView = view;
    view.setRenderer(this);
    view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    view.setPreserveEGLContextOnPause(true);

Here is the call stack:

06-06 22:33:19.824 16800-16800/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: setRenderer has already been called for this instance.
at android.opengl.GLSurfaceView.checkRenderThreadState(GLSurfaceView.java:1893)
at android.opengl.GLSurfaceView.setRenderer(GLSurfaceView.java:348)
at com.mapzen.tangram.MapController.(MapController.java:211)
at com.mapzen.tangram.MapView.getMapInstance(MapView.java:49)
at com.mapzen.tangram.MapView.getMap(MapView.java:41)
at com.mapzen.android.graphics.MapReadyInitializer.onMapReady(MapReadyInitializer.java:29)
at com.mapzen.android.graphics.MapInitializer$1.onSceneReady(MapInitializer.java:113)
at com.mapzen.tangram.MapController$14.run(MapController.java:1355)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Steps to Reproduce

To reproduce you must rotate the phone 90 degree and rotate it back -90 degree quickly. It must be rotated back -90 degree so that your MainActivity onStop gets called before the onMapReady gets called.

Mapzen SDK & Android Version

Mapzen 1.6.1. Android 8 Oreo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions