Android 7 issues

Hi jMonkeys,

I’ve received my new tablet, the NVIDIA SHIELD Tablet K1 and the first thing that I did was to test my jMonkey game on it. It works perfect, very smoothly and I was very happy.

However, I update it from Android 6 to Android 7 and the game starts to fail. Some of my transparent textures doesn’t appear and weird exceptions start to appear. I’ve tested the game in several devices (Sony Xperia Z3 compact with Android 6 and BQ U Plus with Android 6 and 7) and the same. While the game works fine on Android 6, something happens on Android 7 and the game starts to fail.

I’ve made the same test with my previous game (Tic Tac Toe - Revolution!) and the same. Works fine on Android 6 but not on Android 7.

I’ve been looking for the source of the problem but I don’t have any clue and all the stuff related with the android harness is out of my understood.

The exception thown by my NVIDIA tablet:

05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: Grave Exception thrown in Thread[GLThread 3320,5,main]
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: java.lang.IndexOutOfBoundsException: index=768 out of bounds (limit=12)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at java.nio.Buffer.checkIndex(Buffer.java:528)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at java.nio.ByteBufferAsFloatBuffer.get(ByteBufferAsFloatBuffer.java:95)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.collision.bih.BIHTree.initTriList(BIHTree.java:92)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.collision.bih.BIHTree.<init>(BIHTree.java:135)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.collision.bih.BIHTree.<init>(BIHTree.java:139)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.scene.Mesh.createCollisionData(Mesh.java:966)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.scene.Mesh.collideWith(Mesh.java:995)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.scene.Geometry.collideWith(Geometry.java:450)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.scene.Node.collideWith(Node.java:611)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.scene.Node.collideWith(Node.java:611)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at superpepe.states.EstadoModoHistoria.disparar(EstadoModoHistoria.java:2855)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at superpepe.states.EstadoModoHistoria.logicaJuego(EstadoModoHistoria.java:4257)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at superpepe.states.EstadoModoHistoria.update(EstadoModoHistoria.java:464)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.app.state.AppStateManager.update(AppStateManager.java:287)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:236)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.app.AndroidHarnessFragment.update(AndroidHarnessFragment.java:577)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1553)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)
05-01 18:54:21.179 31755 31774 E com.jme3.app.AndroidHarnessFragment: 

Has someone else got similar experiencies with Android 7? Any ideas of the source of the problem?

The class EstadoModoHistoria is your code. What are the lines in the exception doing? Could you maybe post the methods?

Hi,

I’m making a raycast to shot a proyectile.

Inside EstadoModoHistoria there is an update where I have my logic. Inside that update, if the user has pressed the shot button, I shot a proyectile. To shoot the proyectile I make a raycast. The exception is in function disparar() line 2855

private void disparar(int rand, float desv){

    Vector2f miraGUIpos = new Vector2f(miraGUI.getLocalTranslation().x + miraGUI.getWidth()*0.5f,   // Añadimos el 1/2 del tamaño del panel para compensar offset
                                       miraGUI.getLocalTranslation().y + miraGUI.getHeight()*0.5f); // Añadimos el 1/2 del tamaño del panel para compensar offset

    //
    // Gestión del raycasting
    //
    Vector3f origin    = cam.getWorldCoordinates(miraGUIpos, 0.0f);
    Vector3f direction = cam.getWorldCoordinates(miraGUIpos, 0.5f);
    direction.subtractLocal(origin).normalizeLocal();

    Ray ray = new Ray(origin, direction);
    CollisionResults results = new CollisionResults();
    getState(EstadoModelos.class).getModelRoot().collideWith(ray, results);    // This is the line 2854!!!
    
    if (results.size() > 0) {    

The function disparar is called inside the function logicaJuego that it is called in the update of EstadoModoHistoria that extends BaseAppState.

I hope this helps…

Could you show the code in line 2855? Or add line numbers so we know what line is 2855.

Yes,

2854//    getState(EstadoModelos.class).getModelRoot().collideWith(ray, results);   
2855//    
2856//    if (results.size() > 0) {

Is a bit stragne that the line 2855 has no code…

You need to debug it whilst running it on a virtual device i guess.