嗨,我正在使用黄油刀,我从 https://github.com/JakeWharton/butterknife下载了示例代码
并且还从
http://jakewharton.github.io/butterknife/
每当我运行该示例时,都会按如下方式获取 cat-log
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)
我已经访问过很多链接,但没有任何效果!请帮忙!!
我也有一次异常跟踪如下
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