Momoko_Fan said:
@normen: you can still test this particular part .. In the emulator if the app loads but crashes (opengl error etc) then you know it works
Yeh, I looked in the ant script but I couldn't find anything so the comment still stands :P
Momoko_Fan said:
@normen: you can still test this particular part .. In the emulator if the app loads but crashes (opengl error etc) then you know it works
The install ant command just calls “adb install” which isn’t running the app
Android SDK isn’t exposing any ant command to run the app. That part must be handled by the plugins (Eclipse ADT or NBAndroid).
However I found this:
Launch app through adb shell - Android News & UpdatesAndroid News & Updates
You only need the package and activity name and then you can call the appropriate executable
@normen - all this looks very interesting, I’ve been waiting for something like this for a while. So I’ve taken one of the Android/JME3 programs that I’ve developed in Eclipse and I have tried to compile it with jMonkey IDE. I’ve found lots of issues - possibly I am not doing things right.
Importing rules file: toolsantmain_rules.xml
Creating output directories if needed...
Compiling aidl files into Java classes...
Compiling RenderScript files into Java classes and RenderScript bytecode...
Generating R.java / Manifest.java from the resources...
FPAStatue.compile:
Compiling 2 source files to F:JacobjMonkeyFPAStatueAndroidJmemobilebinclasses
Converting compiled files and external libraries into F:JacobjMonkeyFPAStatueAndroidJmemobilebinclasses.dex...
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/pineberry/fpa/MainActivity$1;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
at com.android.dx.command.dexer.Main.processClass(Main.java:372)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
at com.android.dx.command.dexer.Main.access$400(Main.java:59)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:313)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
at com.android.dx.command.dexer.Main.run(Main.java:185)
at com.android.dx.command.dexer.Main.main(Main.java:166)
at com.android.dx.command.Main.main(Main.java:90)
trouble processing "java/security/Provider.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
You cannot import android projects, just make a normal jME3 BasicGame project and move the code there. To edit and use android projects “standalone”, install NBAndroid, which is added to the update center list with the Android Deployment plugin.
@normen, I am not importing the project. I create a new project and then reinserting all my code from the Eclipse project and adding the necessary Android resources. I think this error is something to do with the creation or linking of the generated resource file R. As I have a few of them I think JME is getting confused and attempts to duplicate them. I started eliminating them but now I am unable to refresh the project so that it would regenerate the R.java file. Quiting JME no longer works and clicking and unclicking of the Android deployment (as suggested in that dialog box) in the project properties does nothing.
What is “all the code”? Android specific code should go into the android project (but ideally there should be none), all other game code in the main project. Apart from that you don’t need to add anything to the resource files, the assets.jar file is added automatically to the project (all asset data should go to the assets folder obviously).
Edit: Also, make sure to press “OK” as written in the hint to delete/recreate the project.
Oh, I just realize that you probably deleted code from the MainActivity because it was underlined red or something, you don’t have to do that. Installing NBAndroid will make sure that the editor knows the android class path and the red lines disappear if they disturb you or you want to code in the android project with special android classes (which you should not need to as eventually most functions of a phone will be wrapped in some platform-independent jME3 api, like e.g. TouchEventListener). Ideally you only have to configure things like the android icon or application name and similar to deploy your normal jME3 application to android.
OK, I’ll give it a go. I think at this stage a proper way would be to use NBAndroid if you need to develop custom Android-jME3 application (e.g. with Android specific interfaces such as touch and gestures, or the use of the Android database). The new AndroidSupport is applicable to jME3 application that need to be ported whole to Android as they are (e.g. they use Nifty for their GUI). This seems to be the way to go if you do not want to port all your jME3 code to Eclipse, which has better support for Android than NetBeans - this is what I am doing at the moment after my jME3 application is up and running. However jME3 IDE is indisputably the environment to use for.jME3 development.
Again, the plugin just creates a completely normal android project you can edit with NBAndroid (and that you should be able to open in eclipse as well) and makes sure it has all libraries and code you defined in your main project when you build that.
Also, I strongly suggest not making your application depend on android-specific code too much but make it as platform independent as possible. So don’t write too much of your code in the actual android project where you have access to the android.jar, just whats really needed for android. This way future deployment options like iOS, WebGL etc. etc. will work without hassle. We see jME3 less as a library and more as a platform to develop games. Why only deploy your game to android when it will run fine in a browser or another device too?
@Normen: Do you allready have an idea how to create a deployment option for iOS ? There is still no standard JRE included with iOS.
What I understand from the Unity website is that it created an Xcode project for you. Are you going to do a java->objective C conversion for jME3 ?
Vortex said:
@Normen: Do you allready have an idea how to create a deployment option for iOS ? There is still no standard JRE included with iOS.
What I understand from the Unity website is that it created an Xcode project for you. Are you going to do a java->objective C conversion for jME3 ?
That’s a nice tool. I’m going to buy a new phone next summer. It looks like all options are still open with this tool (Android or IPhone/iOS).
Yeah, it doesn’t quite work out of the box yet otherwise I would have built it into the deployment right away but I’m playing with it every now and then… Basically we would go the way of converting the android project thats created to a xmlvm project (see their documentation) and then using that to build android and iOS. If anyone digs into this and finds out interesting stuff then report back here, its easy to try since you can rebuild the android project at any time
Having a problem getting started with the SDK android stuff.
I created a Basic Game with the ‘new project’ option and then added the android option. When I try to build or run I get the following messages. I have not changed any of the generated code. Help.
Morris
init:
Deleting: /Users/morrisford/jMonkeyProjects/MorrisBasicGame2/build/built-jar.properties
deps-jar:
Updating property file: /Users/morrisford/jMonkeyProjects/MorrisBasicGame2/build/built-jar.properties
compile:
Copying 1 file to /Users/morrisford/jMonkeyProjects/MorrisBasicGame2/build
Copy libraries to /Users/morrisford/jMonkeyProjects/MorrisBasicGame2/dist/lib.
To run this application from the command line without Ant, try:
java -jar “/Users/morrisford/jMonkeyProjects/MorrisBasicGame2/dist/MyGame.jar”
Copying 12 files to /Users/morrisford/jMonkeyProjects/MorrisBasicGame2/mobile/libs
jar:
run-android:
Android SDK Tools Revision 10
Project Target: Android 2.2
API level: 8
Hm, no idea, is there two jMonkeyEngine3.jar files being copied in the mobile project libs somehow?
In the project, I found one in dist/lib and one in mobile/libs. That’s what I would expect. Can you build a basic game from the project menu, add the mobile option and have it build and run?
Morris
Yeah, sure, and others too, thats why I wonder whats wrong there…
I removed the install of the SDK and the projects space and reinstalled from a new download.
I then installed the android support plugin.
Created a basic game.
Added the mobile option.
The MainActivity.java has errors on every line but it runs and installs to an android device.
I then added the jme3-android library. The errors in MainActivity went away and the error from before came back on trying to run.
I removed the jme3-android library and the errors in MainActivity came back but the program will not run and the error is as before.
It would appear that
adding the library jme3-android that way is not the correct thing to do.
removing that library leaves a copy somewhere.
What library do I add to get rid of the errors in MainActivity and still be able to run the program?
Morris
Re-read the first post, the android libraries are added automatically and the errors in the MainActivity are only in the editor, install NBAndroid (the plugin named “Android”) to have the editor recognize the files class path and the android project correctly. The point is that your project is a normal jME3 application and android is just one of the deployment options.
Thanks for your help. Now that I understand what that post meant, it’s easier to understand what that post meant.
Morris