Android + Ubuntu 12.04 + Eclipse(Android SDK)
Step 0: First Try using the jMonkey SDK it is much easier!!!
I had to use Eclipse because my machine would not play nice with Net Beans IDE.
Step 1: Download the Android SDK from
http://developer.android.com/sdk/index.html
It has the eclipse IDE and the android sdk tools
Step 2:
Making your Android Device and Computer Talk
http://developer.android.com/tools/device.html
Follow the Setting up Device for Development
You might have to restart the adb as sudo for eclipse to see your device instead of listing it as ???
cd /adt-bundle-linux/sdk/platform-tools/
.adb kill-server
sudo ./adb start-server
./adb devices
Step 3:
Launch the eclipse IDE
adt-bundle-linux/eclipse/eclipse
Step 4:
Create a new Android Project
From your Nightly JME build download copy
jME3-android.jar,jME3-core.jar,jMonkeyEngine3.jar into your Eclipse Project “libs” folder
In your Eclipse Project Properties → Java Build Path Screen → Libraries
click Add Jar Button and add the jars above from the libs folder
In your Eclipse Project Properties → Java Build Path → Order and Export
Select the Jars
Step 5:
Replace the Eclipse Generated MainActivity class code with
[java]
import android.content.pm.ActivityInfo;
import com.jme3.app.AndroidHarness;
import com.jme3.system.android.AndroidConfigChooser.ConfigType;
public class MainActivity extends AndroidHarness {
public MainActivity(){
// Set the application class to run
appClass = “yourpackage.HelloJME3”;
// Try ConfigType.FASTEST; or ConfigType.LEGACY if you have problems
eglConfigType = ConfigType.BEST;
// Exit Dialog title & message
exitDialogTitle = “Exit?”;
exitDialogMessage = “Press Yes”;
// Enable verbose logging
eglConfigVerboseLogging = false;
// Choose screen orientation
screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
// Invert the MouseEvents X (default = true)
mouseEventsInvertX = true;
// Invert the MouseEvents Y (default = true)
mouseEventsInvertY = true;
}
}
[/java]
add a HelloJME3.java class and copy
[java]
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
public class HelloJME3 extends SimpleApplication{
@Override
public void simpleInitApp(){
Box b = new Box(Vector3f.ZERO, 1,1,1);
Geometry geom = new Geometry(“Box”,b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setColor(“Color”, ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
}
[/java]
Step 6
Run The Project on the device and see the nice blue box
In Eclipse click on your project and add a Run Configuration of Run Android Application
Make sure its using your device and not a Emulator.
You should see a nice blue Box and the stats text of JME
This took me awhile to figure out so let me know if you get stuck.