Android App Crashes Suddenly while running?

前端 未结 5 1871
不知归路
不知归路 2020-12-13 19:05

What my App does ? The App I am developing is a typical client server App which talks to a windows server using Wifi. The Application has multiple Activitie

5条回答
  •  执笔经年
    2020-12-13 19:09

    I don't have enough rep to comment on other people's answers, but I think Error 454's answer is pretty close.

    I had a similar problem with my own app with application restarting with no message. My problem was caused by an array overflow where I was trying to access index n+1 in an array of n objects in my native code. The fact that no error is reported by the JVM also indicates it caused by your native code.

    This question: c++ Jni Reference Table overflow has a very similar error log to your update 2, further indicating that your error lies in not having matched your get and release calls.

    If you don't understand what the JNI pinned reference table is, I'd like to direct your attention to the JNI Specification sections titled "Accessing Java Objects", and the following section "Accessing Primitive Arrays".

    Finally, some snippets of your native code where you access primitive data arrays would be useful to help solve your problem, but in the meantime I'd like draw your attention to the final comment on the answer to ReferenceTable overflow (max=512) JNI which reads:

    GetObjectArrayElement returns object with local reference on it, so you need to delete local reference. But you should do that only when you are done with array elements. So you should put DeleteLocalRef(oneDim) after releaseIntArrayElements(oneDim).

    So please, double check that you have matched Get/Release calls when you access your array elements and, when you no longer need access to it, delete the local reference. It is possible that you are hitting the end of the JNI pinned reference table because you are not deleting old objects. Remember, JNI is just a c interface for Java, so you have to help out the garbage collection for your native code.

提交回复
热议问题