很无语,不知道怎么回事,突然原来导入jbox2d的项目全都不能运行了 都报这个Error
05-17 01:48:16.204: E/AndroidRuntime(27697): FATAL EXCEPTION: main
05-17 01:48:16.204: E/AndroidRuntime(27697): java.lang.NoClassDefFoundError: org.jbox2d.collision.AABB
05-17 01:48:16.204: E/AndroidRuntime(27697): at com.bf.MySurfaceView.<init>(MySurfaceView.java:47)
05-17 01:48:16.204: E/AndroidRuntime(27697): at com.bf.MainActivity.onCreate(MainActivity.java:15)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.os.Looper.loop(Looper.java:150)
05-17 01:48:16.204: E/AndroidRuntime(27697): at android.app.ActivityThread.main(ActivityThread.java:4293)
05-17 01:48:16.204: E/AndroidRuntime(27697): at java.lang.reflect.Method.invokeNative(Native Method)
05-17 01:48:16.204: E/AndroidRuntime(27697): at java.lang.reflect.Method.invoke(Method.java:507)
05-17 01:48:16.204: E/AndroidRuntime(27697): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
05-17 01:48:16.204: E/AndroidRuntime(27697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
05-17 01:48:16.204: E/AndroidRuntime(27697): at dalvik.system.NativeStart.main(Native Method)
就是一个很普通的jbox2d例子而已
所有的导入jbox2d的项目运行都找不到AABB这个类?环境什么的应该也没有错,因为原来都能运行,也细心检查过了,难道eclipse里有对android导包的特殊方法?java程序里导入jbox2d包没有问题,就android项目有问题,不知道怎么回事,最近新换来androidSDK和eclipse3.7.2,难道是这原因,希望碰到高手帮忙,谢谢
解决E/AndroidRuntime(27697): java.lang.NoClassDefFoundError: org.jbox2d.collision.AABB错误应该这样:
public class MySurfaceView extends SurfaceView implements Callback, Runnable, ContactListener{
.....................
}implements后加上ContactListener就行了,我也是刚学琢磨了两天
但还有一处问题解决不了E/AndroidRuntime(27697): at com.bf.MainActivity.onCreate(MainActivity.java:15),我也是上网搜答案呢