Hey all, I received a termination on my app and this error in the logcat:
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): FATAL EXCEPTION: main
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): java.lang.ArrayIndexOutOfBoundsException
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at 开发者_如何学JAVAcom.project.main.main.analyzeFace(main.java:316)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.project.main.main.access$1(main.java:209)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.project.main.main$1$1.run(main.java:381)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Handler.handleCallback(Handler.java:587)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Handler.dispatchMessage(Handler.java:92)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.os.Looper.loop(Looper.java:143)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at android.app.ActivityThread.main(ActivityThread.java:4701)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 22:41:25.193: ERROR/AndroidRuntime(30974): at dalvik.system.NativeStart.main(Native Method)
When I tried snapping a photo in my app. Any idea what this could be?
You are pointing to an offset of an array which is bigger than the number of array's elements (non-initialized index).
Most likely you're iterating over an array with a helper variable, and incrementing it in each iteration, but at some point, that variable gets over the number of elements in the array.
The index you tried to access may be over its total count. Make sure the index number is in range of array you are using. it's hard to answer without source code.
精彩评论