In trying to diagnose where my Annotation problem was I wasn’t getting the full stack trace and hence didn’t know exactly where the problem was. After stumbling around one why I found a way to get the full stack trace; run the application from Eclipse in Run mode rather than Debug Mode:
% emulator &
% adb logcat
Then in Eclipse ran the application the application using Run. A message on the emulator UI says; “An error has occurred in process com.saville.tests … <Force Quit>”. And then in the logcat trace we see the full backtrace.
I/ActivityThread( 537): Loading code package com.saville.tests (in com.saville.tests)
D/ActivityThread( 537): Performing launch of ActivityRecord{4001cda0 {com.saville.tests/com.saville.tests.testAnnotation}}
V/testAnnotation( 537): onCreate: E
V/testAnnotation( 537): testAnno: E
V/testAnnotation( 537): Declared names: onCreate
V/testAnnotation( 537): Declared names: testAnno
V/testAnnotation( 537): cl.getAnnotation dies with 'native method not implemented'
D/dalvikvm( 537): Exception java/lang/RuntimeException from Looper.java:76 not caught locally
D/dalvikvm( 537): Exception java/lang/RuntimeException from ZygoteInit.java:1176 not caught locally
D/AndroidRuntime( 537): Shutting down VM
W/dalvikvm( 537): threadid=3: thread exiting with uncaught exception (group=0x4000e648)
E/AndroidRuntime( 537): Uncaught handler: thread Main exiting due to uncaught exception
E/AndroidRuntime( 537): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.saville.tests/com.saville.tests.testAnnotation}: java.lang.UnsupportedOperationException: native method not implemented
E/AndroidRuntime( 537): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1397)
E/AndroidRuntime( 537): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1410)
E/AndroidRuntime( 537): at android.app.ActivityThread.access$1200(ActivityThread.java:76)
E/AndroidRuntime( 537): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:980)
E/AndroidRuntime( 537): at android.os.Handler.dispatchMessage(Handler.java:80)
E/AndroidRuntime( 537): at android.os.Looper.loop(Looper.java:71)
E/AndroidRuntime( 537): at android.app.ActivityThread.main(ActivityThread.java:2506)
E/AndroidRuntime( 537): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 537): at java.lang.reflect.Method.invoke(Method.java:380)
E/AndroidRuntime( 537): at android.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1170)
E/AndroidRuntime( 537): at android.os.ZygoteInit.main(ZygoteInit.java:1121)
E/AndroidRuntime( 537): at android.dalvik.NativeStart.main(Native Method)
E/AndroidRuntime( 537): Caused by: java.lang.UnsupportedOperationException: native method not implemented
E/AndroidRuntime( 537): at java.lang.Class.getDeclaredAnnotations(Native Method)
E/AndroidRuntime( 537): at java.lang.Class.getAnnotations(Class.java:202)
E/AndroidRuntime( 537): at java.lang.Class.getAnnotation(Class.java:185)
E/AndroidRuntime( 537): at com.saville.tests.testAnnotation.testAnno(testAnnotation.java:33)
E/AndroidRuntime( 537): at com.saville.tests.testAnnotation.onCreate(testAnnotation.java:19)
E/AndroidRuntime( 537): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:786)
E/AndroidRuntime( 537): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1367)
E/AndroidRuntime( 537): ... 11 more
I/Process ( 461): Sending signal. PID: 537 SIG: 3
I/dalvikvm( 537): threadid=7: reacting to signal 3
I/dalvikvm( 537): DALVIK THREADS:
I/dalvikvm( 537): "Main" prio=5 tid=3 NATIVE
I/dalvikvm( 537): | group="main" sCount=1 dsCount=0 s=0 obj=0x4000eca0
I/dalvikvm( 537): | sysTid=450 nice=0 sched=0/0 handle=-1090962004
I/dalvikvm( 537): at android/os/BinderProxy.transact(Native Method)
I/dalvikvm( 537): at android/app/ActivityManagerProxy.handleApplicationError(ActivityManagerNative.java:1205)
I/dalvikvm( 537): at android/os/RuntimeInit.crash(RuntimeInit.java:234)
I/dalvikvm( 537): at android/os/RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:53)
I/dalvikvm( 537): at java/lang/ThreadGroup.uncaughtException(ThreadGroup.java:853)
I/dalvikvm( 537): at java/lang/ThreadGroup.uncaughtException(ThreadGroup.java:850)
I/dalvikvm( 537): (break frame)
I/dalvikvm( 537): at android/dalvik/NativeStart.main(Native Method)
I/dalvikvm( 537): (break frame)
Here is a tool to enhance your logcat experience
Windows link http://adrianvintu.com/blogengine/post/Colored-Logcat-Script-for-Windows.aspx
Linux link http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/
BR,
Adrian Vintu
Comment by Adrian Vintu — November 25, 2009 @ 2:58 am