Missing classes running on android

Hi,

I’ve starting to port my game to android and I’m getting NoClassDefFoundError for multiple classes both written myself and engine classes. Some of the classes exist in the dex file and other don’t… How could I get rid of this?

Thanks

List looks fine from here.

1 Like

There’s an issue with your project configuration. Without more details about what tools you’re using, how you’ve configured them, and what you’ve tried to do to fix the problem there’s nothing we can do to help you diagnose and fix the issue.

What android version are you targetting? Android will only support up to a specific java version based on your target android version. You cannot go above it.

And also, information is key. Please provide a stacktrace. Else people who know whats up like paul cant really provide assistance.

Hi all,

What I meant is that I got NoClassDefFoundError for both my classes and engine classes like there was some missing classes not exported to the dex file and packed in the apk

The project originaly was designed to be an applet but not being able to run them in almost any browser I’m re-writing it to later export it to both desktop and android. @danielp I’m using jme sdk 3.1.0 with nothing special, just setup the desktop and android generation.

@jayfella I’ve set android 4.0.3 or better (lower versions of android just failed to export the project and it’s using jdk7. The stack trace is a simple NoClassDefFoundError for a class that exists.

Finally I’ve got to a workaround, the problem seems to be related with my previous applet-related code, for example I was using the AppletHarness to check if the game was running on standalone app or applet in this way:

public class Main extends LegacyApplication
{
....
    @Override
    public void initialize()
    {
        super.initialize();
        if(AppletHarness.getApplet(this)!=null)
        {
            // Do applet stuff
        }
        else
        {
            // Do desktop stuff
        }
............
............
}

The AppletHarness was one of the not found classes, so I’ve bypased all that code by checking the java.vm.name system propertly to be dalvik this way:

public class Main extends LegacyApplication
{
....
    @Override
    public void initialize()
    {
        super.initialize();
        if("Dalvik".equals(System.getProperty("java.vm.name")))
        {
            // Do android stuff
        }
        else if(AppletHarness.getApplet(this)!=null)
        {
            // Do applet stuff
        }
        else
        {
            // Do desktop stuff
        }
............
............
}

Do you know any better method to detect if it’s running on android?

Also, is there any way I could get the android context from the rest of jme code? I would like to be able to use Context.getFilesDir() and/or Context.getCacheDir() to save some data or maybe there’s some better way to do that…

Thanks