UPADTE: See the wiki page on jme3 and android for detailed instructions.
in time for beta I finally added android deployment to the SDK!
To use it, you need to install the newly added “Android Support” plugin via Tools->Plugins (nightly update center required of course). Also, you will need the Android SDK from google installed in some folder on your computer.
Go to the jMonkeyEngine SDK settings and set a path to the android SDK, you will also be asked for a path to the android SDK any time you try to use android functions and have set none.
After that you can enable android deployment in the project settings of any normal jme3 “BasicGame” project.
When you enable android deployment a “mobile” folder will be created in the project folder that contains a complete android project with correct settings to run the application using the AndroidHarness, when you build your project, an apk file will be created in the dist folder. Update: An “Android Files” node is added to the project to easily edit the android config and source files.
You can also run the project on the emulator by selecting the “Android Emulator” build configuration next to the run button but the emulator sadly doesn’t support OpenGL 2.0 yet. Update: The run target actually uses the default device set in the android configuration utility, so if you set that to a phone you can run the application directly on your phone!
Work in progress, please test this on all platforms and give feedback, experts may look at nbproject/mobile-impl.xml and suggest other build targets and improvements to the project configuration.
- The package name parameter is only used when creating the project and only sets the android MainActivity package name
- The needed jMonkeyEngine3.jar for android comes with the plugin and is automatically added to the android build
- All non-android project libraries are automatically excluded from the android build, this is currently hard-coded in the build script, check nbproject/mobile-impl.xml for the details
- The main application class parameter for the AndroidHarness is taken from the jme3 project settings when enabling android deployment but currently not being updated when the main class package or name changes
- When you disable the mobile deployment option currently the whole “mobile” folder is deleted
- The “errors” in MainActivity.java are only displayed because the editor doesn’t know the class path of the android project, they are not problematic
- Installing NBAndroid will allow the editor to recognize the android project class path and get rid of the error marks
- You do not need the NBAndroid plugin for this to work however it will not interfere and will in fact allow you to edit the android source files and project more conveniently.