Physics (Box2d) Beginner Setup Errors

  ... tutorials on how to use AndEngine.

Physics (Box2d) Beginner Setup Errors

Postby n8 » Wed Dec 08, 2010 5:41 pm

hello everybody,

Sorry if I am just blind, but i cannot find a basic setup tutorial for box2d. I have searched this forum over and over and tried to follow the tuts that are available for box2d, but I keep getting force closes no matter what i do. I tried to copy over the basic physics example and reproduce it in my environment but still always gets a force close. When debugging, the force close is always happening when i try to create the physicsworld object. Any help would be greatly appreciated as I have been banging my head against the wall trying to get this to work.
Last edited by n8 on Fri Dec 10, 2010 12:02 am, edited 1 time in total.
n8
 
Posts: 25
Joined: Fri Dec 03, 2010 9:41 pm

Re: Physics (Box2d) Beginner Tutorial??

Postby chozabu » Thu Dec 09, 2010 3:21 am

can you compile and run the physics examples?
what is the output of adb logcat?
chozabu
 
Posts: 106
Joined: Sat Oct 30, 2010 10:57 pm

Re: Physics (Box2d) Beginner Tutorial??

Postby n8 » Thu Dec 09, 2010 7:49 am

the physics example compiles but when i try to run it, it will force close every time on the initialization of the physicsworld. here is a logcat dump:
W/dalvikvm( 336): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/anddev/andengine/extension/physics/box2d/PhysicsWorld;.<clinit>
D/AndroidRuntime( 336): Shutting down VM
W/dalvikvm( 336): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 336): FATAL EXCEPTION: main
E/AndroidRuntime( 336): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 336): at com.example.andEngineTest.andEngineTest.onLoadScene(andEngineTest.java:111)
E/AndroidRuntime( 336): at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(BaseGameActivity.java:159)
E/AndroidRuntime( 336): at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(BaseGameActivity.java:83)
E/AndroidRuntime( 336): at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:1981)
E/AndroidRuntime( 336): at android.view.View.dispatchWindowFocusChanged(View.java:3788)
E/AndroidRuntime( 336): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:658)
E/AndroidRuntime( 336): at android.view.ViewRoot.handleMessage(ViewRoot.java:1921)
E/AndroidRuntime( 336): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 336): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 336): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 336): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 336): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 336): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 336): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 336): Caused by: java.lang.UnsatisfiedLinkError: Library andenginephysicsbox2dextension not found
E/AndroidRuntime( 336): at java.lang.Runtime.loadLibrary(Runtime.java:461)
E/AndroidRuntime( 336): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 336): at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<clinit>(PhysicsWorld.java:30)
E/AndroidRuntime( 336): ... 15 more
W/ActivityManager( 58): Force finishing activity com.example.andEngineTest/.andEngineTest
D/dalvikvm( 58): GC_EXPLICIT freed 6913 objects / 310960 bytes in 168ms
I/WindowManager( 58): Setting rotation to 0, animFlags=1
I/ActivityManager( 58): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=18 uiMode=17 seq=7}
W/ActivityManager( 58): Activity pause timeout for HistoryRecord{43fe6068 com.example.andEngineTest/.andEngineTest}
W/WindowManager( 58): Window freeze timeout expired.
W/WindowManager( 58): Force clearing orientation change: Window{4400b300 Toast paused=false}
D/dalvikvm( 58): GC_EXPLICIT freed 1152 objects / 57432 bytes in 110ms
W/ActivityManager( 58): Activity destroy timeout for HistoryRecord{43fe6068 com.example.andEngineTest/.andEngineTest}
W/InputManagerService( 58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43f89bb0
I/Process ( 336): Sending signal. PID: 336 SIG: 9
I/ActivityManager( 58): Process com.example.andEngineTest (pid 336) has died.
I/WindowManager( 58): WIN DEATH: Window{4400b300 Toast paused=false}
I/WindowManager( 58): WIN DEATH: Window{4400ff00 com.example.andEngineTest/com.example.andEngineTest.andEngineTest paused=false}
n8
 
Posts: 25
Joined: Fri Dec 03, 2010 9:41 pm

Re: Physics (Box2d) Beginner Tutorial??

Postby chozabu » Thu Dec 09, 2010 10:19 pm

Hmm, will you also post your code please?
chozabu
 
Posts: 106
Joined: Sat Oct 30, 2010 10:57 pm

Re: Physics (Box2d) Beginner Tutorial??

Postby chozabu » Thu Dec 09, 2010 10:33 pm

Oh - Have you inserted the box2d extension into your project? - check the lib AND libs directories, you need the relevant .so and .jar files - and you probably need to add them to your build settings too.
chozabu
 
Posts: 106
Joined: Sat Oct 30, 2010 10:57 pm

Re: Physics (Box2d) Beginner Tutorial??

Postby n8 » Thu Dec 09, 2010 11:43 pm

AH HA! that was it! I had the lib folder with the appropriate .jar but i did not have the libs folder with appropriate .so files. Thank you so much for your help, that would have taken me forever to figure out.
n8
 
Posts: 25
Joined: Fri Dec 03, 2010 9:41 pm


Return to Tutorials

Who is online

Users browsing this forum: Miyamoto and 28 guests