Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ICS : JNI error attempt to use stale local reference 0x1

Tags:

After upgrading my phone to android 4.03 ics my game dosent open anymore ,it just closes without any error messege on deviCe and with this on eclipse

04-02 16:55:27.672: E/dalvikvm(26884): JNI ERROR (app bug): attempt to use stale local reference 0x1
04-02 16:55:27.672: E/dalvikvm(26884): VM aborting

My game is mainly writen in java but some parts are in c and thats were i think the problem is (not very hard to figure out since its saying JNI ERROR :) )

Of course i dont know where the problem is so i dont give any code

I didnt had this problem on android 2.3

I dont know if it helps but i get this error too sometimes

04-02 16:55:26.061: E/Adreno200-ES11(26884): <qglDrvAPI_glTexImage2D:1913>: GL_STACK_UNDERFLOW
like image 813
SteveL Avatar asked Apr 02 '12 14:04

SteveL


1 Answers

The "stale local reference" error means that you're saving a local reference to some Java object between JNI calls; you need to convert that reference to a global reference using the NewGlobalRef method before doing anything that would cause the reference to persist outside the scope of the one JNI call.

Although strictly this was always necessary -- it's in the JNI spec -- it's only since Ice Cream Sandwich that this actually causes problems on the Android platform.

like image 150
Ernest Friedman-Hill Avatar answered Oct 21 '22 06:10

Ernest Friedman-Hill