使用Generic Motion侦听器时未找到类定义

时间:2012-05-22 17:56:56

标签: java android

我的代码设置在API 7然后我将其更改为API 15,以便我可以onGenericMotionListener

现在我将我的活动定义如下:

  newGame.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                vibe.vibrate(vibValue);

                   if (levelStage == 1 && levelId == 1)
                   {       
                       Intent myIntent = new Intent(v.getContext(), Level.class);
                       startActivity(myIntent);
                   }
                   else
                       displayAlertForNewGame(v.getContext());
            }
        });

每当我尝试启动此活动时,我都会收到错误java.lang.NoClassDefFoundError

使用此代码启动活动

Intent myIntent = new Intent(v.getContext(),myActivity.class);
                        startActivity(myIntent);


05-22 22:49:20.416: E/AndroidRuntime(6327): FATAL EXCEPTION: main
05-22 22:49:20.416: E/AndroidRuntime(6327): java.lang.NoClassDefFoundError: com.code.global.Level
05-22 22:49:20.416: E/AndroidRuntime(6327):     at com.umar.regGame.MainMenu$1.onClick(MainMenu.java:67)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.view.View.performClick(View.java:2449)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.view.View$PerformClick.run(View.java:9027)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.os.Handler.handleCallback(Handler.java:587)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.os.Handler.dispatchMessage(Handler.java:92)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.os.Looper.loop(Looper.java:123)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at java.lang.reflect.Method.invokeNative(Native Method)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at java.lang.reflect.Method.invoke(Method.java:521)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-22 22:49:20.416: E/AndroidRuntime(6327):     at dalvik.system.NativeStart.main(Native Method)

最好的问候

1 个答案:

答案 0 :(得分:0)

问题来自班级com.code.global.Level。这门课来自哪里?它是在jar中,你是否在构建路径中以正确的方式包含它?