Question

Hi i am using Butter Knife for which i downloaded the example code from https://github.com/JakeWharton/butterknife

and also downloaded the jar from

http://jakewharton.github.io/butterknife/

whenever i am running the example keep getting cat-log as follows

04-14 13:36:43.882: I/dalvikvm(6593): Could not find method butterknife.ButterKnife.setDebug, referenced from method com.example.butterknife.SimpleApp.onCreate
04-14 13:36:43.882: W/dalvikvm(6593): VFY: unable to resolve static method 16: Lbutterknife/ButterKnife;.setDebug (Z)V
04-14 13:36:43.882: D/dalvikvm(6593): VFY: replacing opcode 0x71 at 0x0004
04-14 13:36:43.882: D/AndroidRuntime(6593): Shutting down VM
04-14 13:36:43.882: W/dalvikvm(6593): threadid=1: thread exiting with uncaught exception (group=0x41ca52a0)
04-14 13:36:43.890: E/AndroidRuntime(6593): FATAL EXCEPTION: main
04-14 13:36:43.890: E/AndroidRuntime(6593): java.lang.NoClassDefFoundError: butterknife.ButterKnife
04-14 13:36:43.890: E/AndroidRuntime(6593):     at com.example.butterknife.SimpleApp.onCreate(SimpleApp.java:9)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4225)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.app.ActivityThread.access$1300(ActivityThread.java:140)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.os.Looper.loop(Looper.java:137)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at android.app.ActivityThread.main(ActivityThread.java:4895)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at java.lang.reflect.Method.invokeNative(Native Method)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at java.lang.reflect.Method.invoke(Method.java:511)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
04-14 13:36:43.890: E/AndroidRuntime(6593):     at dalvik.system.NativeStart.main(Native Method)

lot of links i have been already visited but nothing works!! please help!!

i also had an exception trace as follows once

04-14 16:33:55.414: I/dalvikvm(11047): Could not find method butterknife.ButterKnife.setDebug, referenced from method com.example.butterknife.SimpleApp.onCreate
04-14 16:33:55.414: W/dalvikvm(11047): VFY: unable to resolve static method 16: Lbutterknife/ButterKnife;.setDebug (Z)V
04-14 16:33:55.414: D/dalvikvm(11047): VFY: replacing opcode 0x71 at 0x0004
04-14 16:33:55.414: D/AndroidRuntime(11047): Shutting down VM
04-14 16:33:55.414: W/dalvikvm(11047): threadid=1: thread exiting with uncaught exception (group=0x41ca52a0)
04-14 16:44:17.789: D/AbsListView(11189): Get MotionRecognitionManager
04-14 16:44:17.796: D/ButterKnife(11189): Looking up view injector for com.example.butterknife.SimpleActivity
04-14 16:44:17.796: D/ButterKnife(11189): Not found. Trying superclass android.app.Activity
04-14 16:44:17.796: D/ButterKnife(11189): MISS: Reached framework class. Abandoning search.
04-14 16:44:17.804: D/AndroidRuntime(11189): Shutting down VM
04-14 16:44:32.203: D/AbsListView(11433): Get MotionRecognitionManager
04-14 16:44:32.210: D/ButterKnife(11433): Looking up view injector for com.example.butterknife.SimpleActivity
04-14 16:44:32.210: D/ButterKnife(11433): Not found. Trying superclass android.app.Activity
04-14 16:44:32.210: D/ButterKnife(11433): MISS: Reached framework class. Abandoning search.
04-14 16:44:32.210: D/AndroidRuntime(11433): Shutting down VM
04-14 16:44:32.210: W/dalvikvm(11433): threadid=1: thread exiting with uncaught exception (group=0x41ca52a0)
04-14 16:44:32.210: E/AndroidRuntime(11433): FATAL EXCEPTION: main
04-14 16:44:32.210: E/AndroidRuntime(11433): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.butterknife/com.example.butterknife.SimpleActivity}: java.lang.NullPointerException
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.os.Looper.loop(Looper.java:137)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread.main(ActivityThread.java:4895)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at java.lang.reflect.Method.invokeNative(Native Method)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at java.lang.reflect.Method.invoke(Method.java:511)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at dalvik.system.NativeStart.main(Native Method)
04-14 16:44:32.210: E/AndroidRuntime(11433): Caused by: java.lang.NullPointerException
04-14 16:44:32.210: E/AndroidRuntime(11433):    at com.example.butterknife.SimpleActivity.onCreate(SimpleActivity.java:45)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.Activity.performCreate(Activity.java:5163)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-14 16:44:32.210: E/AndroidRuntime(11433):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
04-14 16:44:32.210: E/AndroidRuntime(11433):    ... 11 more
Was it helpful?

Solution

i added butterknife-5.0.0-SNAPSHOT.jar , previously i was using jar from http://jakewharton.github.io/butterknife/ version 4.0.1.

Finally the example code is working fine

what i did is

1) enabled annotation processing enter image description here

2) Just enabling annotations processing in eclipse is not enough. must point it to library that will do the actual processing.

enter image description here

for more please follow

https://github.com/JakeWharton/butterknife/issues/12

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top