0

How can I try to locate the source of this error?

I have received a crash log/stack trace from Flurry but it doesn't provide me with any indication of where in my app the crash originated. (i.e. Activity or line number)

I haven't experienced any exception with any devices that I have locally tested with so am at a bit of a loss on where to start.

The users haven't reported the crash through Google Play so I don't have a Google Stack trace. The report came from A SONY XPERIA Z1 and two separate SONY C6903 XPERIA LTE.

The app has around 4000 users so it is only something unusual these users are doing or only occurring on these two devices I guess.

What type of error/bug would cause this type of error?

java.lang.IllegalStateException
android.view.View$1.onClick(View.java:3954)
android.view.View.performClick(View.java:4569)
android.view.View$PerformClick.run(View.java:18553)
android.os.Handler.handleCallback(Handler.java:733)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:212)
android.app.ActivityThread.main(ActivityThread.java:5151)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:515)
android.view.View$1.onClick(View.java:3949)
android.view.View.performClick(View.java:4569)
android.view.View$PerformClick.run(View.java:18553)
android.os.Handler.handleCallback(Handler.java:733)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:212)
android.app.ActivityThread.main(ActivityThread.java:5151)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
dalvik.system.NativeStart.main(Native Method)

Edit: All android:onClick events in the app have a corresponding method in the Activity Class in the following format:

public void methodName(View view) {
}
birdman
  • 1,134
  • 13
  • 13

2 Answers2

1

Are any of your views changed outside of your UI thread? Perhaps the view that manages the .onClick or a method triggered from the onClick() itself is accessing a view that has changed, but the UI thread has no knowledge of

Shane
  • 150
  • 6
  • When you say "changed", what kind of things would constitute changed? I have a number of activities in the app most have on_click events. A main switchboard, a settings page with lots of configuration options and a camera page . The camera page has a surfaceview with an on_click event, that is used to take a picture using the standard surfaceview style camera example from developer.android.com. Once the picture is taken I use a Runnable to play an animation. That's the only thing that runs off the UIthread. It is a pretty lengthy piece of code though. So what should I look for? – birdman May 13 '14 at 14:20
  • its possible that it could be that. I don't know much about surfaceview but you would expect anything that draws to the screen to be run from the UI thread. Just a guess to be honest, its a fairly tricky thing to diagnose especially if not reproducable – Shane May 13 '14 at 14:32
1

I think this occurs when you have a android:onClick attribute in yout layout which references an Activity method that does not exist. The system has to use reflection to look for the method, which can be dangerous. I suggest that you never use this attribute in your views and always set a View.OnClickListener to you clickable views by code.

BladeCoder
  • 12,779
  • 3
  • 59
  • 51
  • I generally use android:onClick instead of View.OnClickListener. Every onClick references a method in my Activity class and works on most other devices. So I can pretty much rule out there being a non existent method. I'll double check that there is no embedded call to a non existing method within the onClick call though. Thanks – birdman May 13 '14 at 14:41
  • Also check that the methods that you reference in onclick in your layout always take a View as first and unique parameter, that they are public and return void: public void myMethod(View v). The simple fact that the error only occurs on some devices and that you have to manually check details like this without the compiler returning any error should be enough to convince you to use OnClickListener instead. – BladeCoder May 13 '14 at 14:56
  • Does it matter that I use (View view) instead of (View v) as I never reference the "view/v" parameter in my code? When you say "The simple fact that the error only occurs on some devices..." are you saying that some devices "expect" that you only use onClickListener and not android:onClick? If so why is android:OnClick in the Android specification? – birdman May 13 '14 at 15:17
  • 1
    I don't think the name of the argument has any impact, no. I suspect that some devices are more or less tolerant to the exactness of the signature of the method. To really isolate the issue you need to find a device where the crash occurs and be able to reproduce it yourself. Another issue with the android:onclick attribute is that you can't use it with Fragments, the system will always look for the method in the Activity. – BladeCoder May 13 '14 at 15:34