Constructing frameBuffers on android throws exception

So I set up a framebuffer for rendering to a texture in my app. On PC it works just fine, but on android I get this:

E/com.jme3.app.AndroidHarnessFragment(12372): SEVERE Exception thrown in Thread[GLThread 4024,5,main]
E/com.jme3.app.AndroidHarnessFragment(12372): java.lang.IllegalStateException: Framebuffer has erronous attachment.
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.renderer.opengl.GLRenderer.checkFrameBufferError(GLRenderer.java:1417)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.renderer.opengl.GLRenderer.updateFrameBuffer(GLRenderer.java:1590)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.renderer.opengl.GLRenderer.setFrameBuffer(GLRenderer.java:1736)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1072)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.renderer.RenderManager.render(RenderManager.java:1137)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.app.AndroidHarnessFragment.update(AndroidHarnessFragment.java:577)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1583)
E/com.jme3.app.AndroidHarnessFragment(12372): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)
E/com.jme3.app.AndroidHarnessFragment(12372): 

The code for construction of the frame buffer is as follows:

public RendererToTexture(RenderManager renderMng) {
    Camera cam = new Camera(512, 512);
    cam.setLocation(new Vector3f(5, 5, 5));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
    cam.setFrustumPerspective(45f, 1f, 1f, 1000f);
    
    offScreenViewPort = renderMng.createPreView("offRenderView", cam);
    offScreenViewPort.setClearFlags(true, true, true);
    offScreenViewPort.setBackgroundColor(new ColorRGBA(0.5f, 0.5f, 0, 0.3f));
    
    FrameBuffer offBuffer = new FrameBuffer(512, 512, 1);
    
    renderedTexture = new Texture2D(512, 512, Format.RGBA8);
    renderedTexture.setMinFilter(Texture.MinFilter.Trilinear);
    renderedTexture.setMagFilter(Texture.MagFilter.Bilinear);
    
    offBuffer.setDepthBuffer(Format.Depth);
    offBuffer.setColorTexture(renderedTexture);
    
    offScreenViewPort.setOutputFrameBuffer(offBuffer);
}

Any ideas?

Similar thread: