Okay, so I’ve got my APK exported and signed, but when I try to run it I get this error message.
[java]java.lang.ClassNotFoundException: mygame.MainApplication[/java]
Here is my main and my mainactivity.
[java]package com.ggworkshop.hexprototype;
import com.jme3.app.AndroidHarness;
import android.content.pm.ActivityInfo;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import com.jme3.system.android.AndroidConfigChooser.ConfigType;
import mygame.MainApplication;
import mygame.Controller;
public class MainActivity extends AndroidHarness{
private int deviceId;
private AssetManager assetManager;
/*
* Note that you can ignore the errors displayed in this file,
* the android project will build regardless.
* Install the 'Android' plugin under Tools->Plugins->Available Plugins
* to get error checks and code completion for the Android project files.
*/
public MainActivity(){
// Set the application class to run
appClass = "mygame.MainApplication";
// 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]
and,
[java]package mygame;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.bullet.BulletAppState;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Node;
import java.util.ArrayList;
/**
-
MainApplication class, calls app states to start game.
-
@author
*/
public class MainApplication extends SimpleApplication {private static MainApplication app;
protected Camera _cam;
protected AppStateManager appStateManager;
protected BulletAppState bulletAppState;
protected Node _rootNode;private boolean init = false;
/**
*
*/
protected DayNight day;public static void main(String[] args) {
getApp().start();
}public static MainApplication getApp() {
if (app == null) {
app = new MainApplication();
}
return app;
}// Sets up essential functions and components
@Override
public void simpleInitApp() {assetManager = getAssetManager(); inputManager = getInputManager(); appStateManager = stateManager; /** Set up Physics */ bulletAppState = new BulletAppState(); appStateManager.attach(bulletAppState); bulletAppState.setEnabled(true); day = new DayNight(rootNode); _cam = cam; _rootNode = rootNode; //flyCam.setEnabled(false); flyCam.setMoveSpeed(50); flyCam.setEnabled(true); MenuAppState x = new MenuAppState(bulletAppState, app, appStateManager, inputManager, assetManager, _rootNode, _cam); stateManager.attach(x); x.setEnabled(true); init = true;
}
/**
- Note: Player is just a simple object I just made up to represent a player
*/
ArrayList players = new ArrayList();
/**
- Adds a player to the game to be associated with the specified controller
- @param controller the controller used by the player
-
@return true if the player object is successfully added to the game
*/
public boolean addPlayer(Controller controller) {
synchronized (players) {
if (init) {
Player nPlayer = new Player(controller, “Models/test_box/test_box.j3o”);
players.add(nPlayer);
return true;
}
}
return false;
}
boolean mainMenu = false;
boolean gameState = false;@Override
public void simpleUpdate(float tpf) {day.cycle();
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}public BulletAppState getBulletAppState() { return bulletAppState;
}
}
[/java] - Note: Player is just a simple object I just made up to represent a player
Any help is much appreciated. I’ve tried messing with my android manifest as well, but it only caused more problems.