Building Projects with Android

Hello, I am just beginning to delve into the world of Android and jME, and I wanted to see if I could run an Android test app on my phone using jME. Thus I went and copied the program in ‘Hello SimpleApplication’, and followed the instructions here to try and run the program on my device.



If I made a mistake and that the sample program cannot be ported directly to Android then you can stop me here.



Continuing on, I faced the same problem as the person in this thread which had the missing MANIFEST.MF file. After copying and renaming AndroidManifest.xml I tried to build the project again, leading me to these errors:



[java]7 errors; aborting

C:UsersEvaDocumentsjME ProjectsTestnbprojectmobile-impl.xml:21: The following error occurred while executing this line:

C:Program FilesAndroidandroid-sdktoolsantbuild.xml:851: The following error occurred while executing this line:

C:Program FilesAndroidandroid-sdktoolsantbuild.xml:853: The following error occurred while executing this line:

C:Program FilesAndroidandroid-sdktoolsantbuild.xml:865: The following error occurred while executing this line:

C:Program FilesAndroidandroid-sdktoolsantbuild.xml:266: null returned: 1

BUILD FAILED (total time: 46 seconds)

[/java]



There were also several

[java]UNEXPECTED TOP-LEVEL EXCEPTION:

java.lang.IllegalArgumentException: already added:[/java]

messages before it. Having naught a clue as to why this happening, I’m turning to this forum for assistance, if possible.



On a somewhat related note, my sdk has been closing itself frequently when I leave it alone for too long, any idea why?



Thank you for any assistance.

(also, I think I’m using the java tags incorrectly?)

This is the solution: http://hub.jmonkeyengine.org/groups/android/forum/topic/issues-building-with-android-sdk-rev-20/?topic_page=3&num=15#post-188755

Successfully built the program, thank you for the help.

Hello again, I am up to Hello Input currently in the tutorials, and I was curious on where would the controls be declared in an Android application? For example if I would want to use the accelerometer for wasd movement, where should it be ideally declared?



Also, I was trying to run the HelloCollision code on Android and received this error. Perhaps someone can shed some light on it?



[java]E/AndroidHarness(18767): Exception thrown in Thread[GLThread 11,5,main]

E/AndroidHarness(18767): com.jme3.asset.AssetLoadException: Failed to open zip file: town.zip

E/AndroidHarness(18767): at com.jme3.asset.plugins.ZipLocator.setRootPath(ZipLocator.java:74)

E/AndroidHarness(18767): at com.jme3.asset.ImplHandler.tryLocate(ImplHandler.java:176)

E/AndroidHarness(18767): at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:267)

E/AndroidHarness(18767): at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:369)

E/AndroidHarness(18767): at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:373)

E/AndroidHarness(18767): at jme3test.helloworld.HelloCollision.simpleInitApp(HelloCollision.java:55)

E/AndroidHarness(18767): at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)

E/AndroidHarness(18767): at com.jme3.app.AndroidHarness.initialize(AndroidHarness.java:473)

E/AndroidHarness(18767): at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:216)

E/AndroidHarness(18767): at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:187)

E/AndroidHarness(18767): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)

E/AndroidHarness(18767): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

E/AndroidHarness(18767): Caused by: java.io.FileNotFoundException: /town.zip (No such file or directory)

E/AndroidHarness(18767): at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)

E/AndroidHarness(18767): at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)

E/AndroidHarness(18767): at java.io.RandomAccessFile.<init>(RandomAccessFile.java:132)

E/AndroidHarness(18767): at java.io.RandomAccessFile.<init>(RandomAccessFile.java:173)

E/AndroidHarness(18767): at java.util.zip.ZipFile.<init>(ZipFile.java:133)

E/AndroidHarness(18767): at com.jme3.asset.plugins.ZipLocator.setRootPath(ZipLocator.java:72)

E/AndroidHarness(18767): … 11 more[/java]

There is Orientation support built in, with the nightly version of jME, I think the other sensors are currently being implemented.

http://hub.jmonkeyengine.org/groups/android/forum/topic/creating-engine-support-for-android-sensor-input/?topic_page=3&num=15#post-189378



For the HelloCollision zip file issue:

http://hub.jmonkeyengine.org/groups/android/forum/topic/assetmanager-problem-with-android/#post-139280



alternatively unzip the file into the correct Asset folder locations (ofc u also need to convert them to .j3o)

Thanks, I was able to load the zip file nicely.



Currently as preparation for a school project, I was instructed to create a simple map which one can move around in using the accelerometer. I was thinking of using the HelloCollision codes as a base and add the ninja to move around with, but I am experiencing sudden drops in fps while moving the camera around. I am thinking of creating my own basic level (since my focus is on accelerometer based movement, using just a cube moving around in a blank area would be fine) but then I haven’t a clue on where to start. Could I ask for someone to point me in the right direction?



Alternatively, I could edit parts of the HelloCollision code to make it run more smoothly, but I haven’t a clue on how to do that either.



Edit: After scouring around for a bit, I figured that I should test the waters by creating a basic stage model, and then use collision(?) to have player models move around in that stage. Atleast I think that’s how it should go.



Question with relation to the Joystick mentioned a post back. Say I would like to record the displacement of the phone using the values in the x and y axis. I am not sure how it reports back the data that is sent by the sensors, but lets say that they return integers in between -100 and 100.



For the first event, I would like to move a cube from static to the right when the y axis is displaced positively(say +25) with a certain speed. Simple enough, it would be like in HelloInput where the x value for the location of the player node is updated with a certain speed when the ‘K’ button is pressed.



For the second event however, I want to move the cube from static to the right with a much faster speed (maybe 3-4 times faster) when the y axis is displaced enough(say +50). How should I go about making the program be able to tell the difference? I figure it would be something like “if ((TimeAtDisplacement50 - TimeWhenStatic) < MinTimeNeeded)”, but are there any functions available that I can use?



Situations where such an input would be used would be in a 3rd person game and the player needs to dodge attacks. Tilt the phone quickly, and they will roll in a direction.

I am trying to implement the joystick in a simple application that displays the x, y and z values on screen, similar to a simple one I made using the android-sdk, but the example code is a bit confusing. Can I ask for a list of necessary methods to implement the joystick and to get the values returned by the sensors?