force close error

  ... the MultiTouch Extension for AndEngine.

force close error

Postby zmatokan » Thu Sep 16, 2010 11:19 pm

Hello. I am a new to Android programming. I am learning about andengine for last few days and i am trying to make multitouch extension work but i get force error everytime. I am using source code from code.google. Collision detection. i created BaseExample, .MultiTouch, MultiTouchController, MultiTouchExeption and CollisionDetectionExample classes. Just copy/pasted from code.google and i get 0 errors but when i try and run it i get force close. I am sorry if this is a stupid question, but i am very new to this and not familiar how to actually put those extensions on andganem in another way. Thanks!
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby Selzier » Fri Sep 17, 2010 12:28 am

We do not have enough information to determine why your program is force closing. Here is a quick overview of how to get the MultiTouchExample working:

1. Create a new Eclipse Project, name it MultiTouchExample for now (same as the actual example).

2. Open your project's workspace folder (ex /Workspace/MultiTouchExample/) and create a directory called "lib". Copy andengine.jar and andenginemultitouchextension.jar to your project's lib folder.

3. Back in Eclipse, refresh your project and expand your /lib folder. Right click on andengine.jar and andenginemultitouchextension.jar and add them to the build path (right click > Build Path > Add to Build Path).

4. Now open your new MultiTouchExample.java. You class should not extend Activity, change this to BaseGameActivity. Delete the auto generated code so your project should look like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class MultiTouchExample extends BaseGameActivity {
  2.  
  3. }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


5. You need to create 3 enums which are used for cards in this project, Card.java, Color.java, and Value.java. In Eclipse, right click on your com.example.MultiTouchExample and click New > Enum. (Do this 3 times, name them Card, Color, and Value).

6. Now all you need to do is add code from the examples. Open /andengineexample/src/org/anddev/andengine/example/MultiTouchExample.java. Copy all of the code from INSIDE the class BaseExample and add this your BaseGameActivity class.

Now just add the code into your enums, copy and paste from the 3 enum files at /andengineexample/src/org/anddev/andengine/example/adt/card/ (Card.java, Color.java, and Value.java) and add the code into your enums, Card, Color, Value.

7. Use CTRL-SHIFT-O in eclipse to Organize Imports and launch!
Selzier
 
Posts: 10
Joined: Sat Sep 11, 2010 7:08 pm

Re: force close error

Postby zmatokan » Fri Sep 17, 2010 2:49 am

Thank you very much. I am gonna try that right now. And sorry for lack of information about the problem, this is my first time asking something on the forum. =)
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby zmatokan » Fri Sep 17, 2010 3:11 am

Hey, i just tried going thru your explanation and i got to the spot where i need to copy BaseExample code to my BaseGame Activity, but i don't have that class. I mean, is that slacc somewhere by "default" or do i have to make it?
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby Selzier » Fri Sep 17, 2010 3:17 am

3. Back in Eclipse, refresh your project and expand your /lib folder. Right click on andengine.jar and andenginemultitouchextension.jar and add them to the build path (right click > Build Path > Add to Build Path).

4. Now open your new MultiTouchExample.java. You class should not extend Activity, change this to BaseGameActivity. Delete the auto generated code so your project should look like this:


If you add andengine.jar to the build path, and import BaseGameActivity (part of andengine) you will not have any errors. You might have to (import org.anddev.andengine.ui.activity.BaseGameActivity;) but to import easy just use Ctrl-Shift-O.

Also take a look at my Hello World tutorial it covers some of that:
http://www.andengine.org/forums/tutorials/tutorial-hello-andengine-a-beginner-s-guide-to-andengine-t593.html
Selzier
 
Posts: 10
Joined: Sat Sep 11, 2010 7:08 pm

Re: force close error

Postby zmatokan » Fri Sep 17, 2010 3:42 am

Works like a charm. =) thanks! i am doing it on an emulator so can't do multitouch, but its a good start, at least its working so i can experiment with it. Kind regards
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby zmatokan » Fri Sep 17, 2010 4:15 am

I don't wanna open another thread. And sorry if i bore you, but i am stuck with BaseExample.java. I find it in almost every example, and whenever i use it i get force error. For example i used PhysicsExample, imported all jars and .so file. Added them into buildpath. Copy/pasted PhysicsExample, and created another class BaseExample where i pasted all the code from BaseExample on code.google. And it runs, but i get force close error. I am wondering if i need to add something to the menu in BaseExample? Can you breafly explain why and how is BaseExample used? I would gladly look it up myself on google but can't find any information. Thanks
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby Selzier » Fri Sep 17, 2010 4:22 am

I don't use BaseExample, I have been just cutting code from the examples and putting them into my own projects, my classes all extend BaseGameActivity (like I explained in the Hello World and Multitouch).

If you are force closing, could be lots of things even missing image files. One of the android tools (in your SDK/tools dir) is adb logcat. Run adb logcat in a command prompt while you run your program in the emulator and you should be able to track down why the force close is happening.
Selzier
 
Posts: 10
Joined: Sat Sep 11, 2010 7:08 pm

Re: force close error

Postby zmatokan » Fri Sep 17, 2010 4:28 am

I see. Ok, time for some debugging =) Cheers
zmatokan
 
Posts: 22
Joined: Thu Sep 16, 2010 11:14 pm

Re: force close error

Postby Selzier » Fri Sep 17, 2010 4:41 am

For example, the code in my post here works fine if you put all the files used into your project:
http://www.andengine.org/forums/physics-box2d-extension/bouncing-faces-in-physicsexample-java-t576.html

The files used in that code ^ are:
/lib/andengine.jar (Always) >add to build path
/lib/andenginephysicsbox2dextension.jar (Physics) >add to build path
/libs/armeabi/libandenginephysicsbox2dextension.so (Physics)
/assests/gfx/box.png (Graphics)
Selzier
 
Posts: 10
Joined: Sat Sep 11, 2010 7:08 pm


Return to MultiTouch

Who is online

Users browsing this forum: No registered users and 2 guests