0

我创建了一个空项目来尝试从https://github.com/jfeinstein10/SlidingMenu实现 SlidingMenu :

当我运行我的应用程序时,它在启动时崩溃,我不知道出了什么问题。

我的安卓代码:

public class _iSellCrazyStuff extends SlidingActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity__i_sell_crazy_stuff);

        setTitle(R.string.attach);
        SlidingMenu menu = new SlidingMenu(this);
        menu.setMode(SlidingMenu.LEFT);
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        menu.setShadowWidthRes(R.dimen.shadow_width);
        menu.setShadowDrawable(R.drawable.shadow);
        menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu.setFadeDegree(0.35f);
        menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        menu.setMenu(R.layout.menu);
    }
}

我的日志猫:

06-26 01:10:40.340: E/Trace(28664): error opening trace file: No such file or directory (2)
06-26 01:10:40.364: W/dalvikvm(28664): Unable to resolve superclass of Lcom/example/it3783application/_iSellCrazyStuff; (473)
06-26 01:10:40.364: W/dalvikvm(28664): Link of class 'Lcom/example/it3783application/_iSellCrazyStuff;' failed
06-26 01:10:40.364: D/AndroidRuntime(28664): Shutting down VM
06-26 01:10:40.364: W/dalvikvm(28664): threadid=1: thread exiting with uncaught exception (group=0x4129c930)
06-26 01:10:40.364: E/AndroidRuntime(28664): FATAL EXCEPTION: main
06-26 01:10:40.364: E/AndroidRuntime(28664): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.it3783application/com.example.it3783application._iSellCrazyStuff}: java.lang.ClassNotFoundException: Didn't find class "com.example.it3783application._iSellCrazyStuff" on path: /data/app/com.example.it3783application-1.apk
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread.access$600(ActivityThread.java:156)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1250)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.os.Looper.loop(Looper.java:137)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread.main(ActivityThread.java:5233)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at java.lang.reflect.Method.invokeNative(Native Method)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at java.lang.reflect.Method.invoke(Method.java:511)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at dalvik.system.NativeStart.main(Native Method)
06-26 01:10:40.364: E/AndroidRuntime(28664): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.it3783application._iSellCrazyStuff" on path: /data/app/com.example.it3783application-1.apk
06-26 01:10:40.364: E/AndroidRuntime(28664):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-26 01:10:40.364: E/AndroidRuntime(28664):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2220)
06-26 01:10:40.364: E/AndroidRuntime(28664):    ... 11 more
06-26 01:10:40.372: I/Process(28664): Sending signal. PID: 28664 SIG: 9
4

1 回答 1

0

听起来您可能没有正确导入 ActionBarSherlock 库。如果使用 Eclipse,请确保 File -> Import -> Import from Existing Code 并选择库。然后在您的项目下,转到属性和 java-build-path -> 项目 -> 添加依赖项

于 2013-06-26T13:34:26.480 回答