Scribe库错误:NoClassDefFoundError

时间:2012-06-18 10:27:54

标签: android noclassdeffounderror

我正在尝试使用Scribe库来练习创建使用OAuth的应用程序。 但是,当我尝试构建我的应用程序时,我收到以下错误:

06-18 12:11:49.336: E/dalvikvm(4800): Could not find class'org.scribe.builder.ServiceBuilder', referenced from method lite.hattrick.main.LoginActivity.onCreate
06-18 12:11:49.336: W/dalvikvm(4800): VFY: unable to resolve new-instance 783 (Lorg/scribe/builder/ServiceBuilder;) in Llite/hattrick/main/LoginActivity;
06-18 12:11:49.336: D/dalvikvm(4800): VFY: replacing opcode 0x22 at 0x0018
06-18 12:11:49.336: E/dalvikvm(4800): Could not find class 'org.scribe.model.Verifier', referenced from method lite.hattrick.main.LoginActivity.onResume
06-18 12:11:49.336: W/dalvikvm(4800): VFY: unable to resolve new-instance 790 (Lorg/scribe/model/Verifier;) in Llite/hattrick/main/LoginActivity;
06-18 12:11:49.336: D/dalvikvm(4800): VFY: replacing opcode 0x22 at 0x0029
06-18 12:11:49.336: D/dalvikvm(4800): DexOpt: unable to opt direct call 0x18d4 at 0x1a in Llite/hattrick/main/LoginActivity;.onCreate
06-18 12:11:49.336: D/dalvikvm(4800): DexOpt: unable to opt direct call 0x18e2 at 0x31 in Llite/hattrick/main/LoginActivity;.onResume
06-18 12:11:49.336: I/dalvikvm(4800): DexOpt: unable to optimize static field ref 0x0ca6 at 0xcc in Llite/hattrick/main/LoginActivity;.onResume
06-18 12:11:49.346: D/dalvikvm(4800): DexOpt: unable to opt direct call 0x18dc at 0xd0 in Llite/hattrick/main/LoginActivity;.onResume
06-18 12:11:49.456: D/AndroidRuntime(4800): Shutting down VM
06-18 12:11:49.456: W/dalvikvm(4800): threadid=1: thread exiting with uncaught exception (group=0x40a75228)
06-18 12:11:49.456: E/AndroidRuntime(4800): FATAL EXCEPTION: main
06-18 12:11:49.456: E/AndroidRuntime(4800): java.lang.NoClassDefFoundError: org.scribe.builder.ServiceBuilder
06-18 12:11:49.456: E/AndroidRuntime(4800):     at lite.hattrick.main.LoginActivity.onCreate(LoginActivity.java:45)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.Activity.performCreate(Activity.java:4543)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2237)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.ActivityThread.access$600(ActivityThread.java:139)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.os.Looper.loop(Looper.java:156)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at android.app.ActivityThread.main(ActivityThread.java:5005)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at java.lang.reflect.Method.invokeNative(Native Method)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at java.lang.reflect.Method.invoke(Method.java:511)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-18 12:11:49.456: E/AndroidRuntime(4800):     at dalvik.system.NativeStart.main(Native Method)

我真的不知道我做错了什么。我通过下载commons-codec和scribe-1.3.0 jar,按照this网站上的说明添加了库。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

所有库文件必须放在名为libs的目录中,该目录与srcassets以及res处于同一级别。

创建该目录,将.jar文件放在那里,Eclipse将负责其余的工作。您无需担心将它们添加到构建路径或其他任何内容。