1

I see alot of post concerning the Android Jni but I still do not have a clear idea how to edit it. I have a Phonegap app that is having JNI Errors when loading a certain page.

From what I have read during research, I need to release the local storage. How do I do this, I am wondering.

All I see to do it but no real clear path on what to do.

If you were going to either release localRef strings or create a globalRef string What would you do?

Thanks ahead.

skwidgets
  • 281
  • 2
  • 8
  • 23
  • Error like [phonegap.js crashes android app](http://stackoverflow.com/questions/4459458/phonegap-js-crashes-android-app)? Have you written any Java<>JNI<>C code? What JNI error do you get? – zapl May 23 '12 at 18:08
  • I have written Java. I have made a number of Phongap apps with Eclipse. What I don't know is where to write the java to release the localRefs in the android project. – skwidgets May 23 '12 at 18:10
  • I have read this http://stackoverflow.com/questions/9376833/referencetable-overflow-max-1024 but it still leaves me lost on were to edit or add code to release the localRefs. – skwidgets May 23 '12 at 18:12
  • You don't have to release local references in JNI, they are all released when your JNI method exits. *What* 'JNI errors' are you getting? – user207421 May 24 '12 at 01:09
  • 05-25 11:54:34.046: E/dalvikvm(5286): Failed adding to JNI local ref table (has 512 entries) – skwidgets May 25 '12 at 23:50

1 Answers1

0

So you have already created 512 local references and you need to create more. You either have to release some of the ones you've already created, via DeleteLocalRef(), if that makes sense in your code, or else request more local slots, via EnsureLocalCapacity() or PushLocalFrame(). I prefer the latter in conjunction with PopLocalFrame(): many coding patterns fit into it, maybe yours.

user207421
  • 305,947
  • 44
  • 307
  • 483