Application Will Run When Installed in Debug Mode, But Compiled APK Does Not

Hi there,

I’ve been working for a few days on my first Android application. I finally got it to run smoothely and how I wanted in my game I tried testing out on my android device.

After installing the application using debug usb mode from the SDK the app worked perfectly. So I decided to go to the next step and compile it to an apk.

I compile to apk, sign it, then install the apk from my drop box. Unfortunately this doesn’t work. All it shows is the default statistics in the lower left corner (FPS Vertices Objects Etc)

I have no idea what the difference is or why this is happening.

If I uninstall and reinstall the app using the sdk debug mode, it works just fine, once again.

I really need some help on why my compiled APK doesn’t work, but the SDK’s debug compilation works.

This is my first application and the answer could be obvious or simple.

Any help will be appreciated!

Thanks for Reading!


does it work properly on the desktop when run from the /dist folder?

Yes it does!

That is what is so mindblowingly strange to me. I debug the app… Works fine using the sdk debug usb connection.

I compile it. The jarfile works just fine on the desktop while the .apk installed on the device just shows the stats in the corner.

If I uninstall the .apk version and reinstall the debug version from the sdk. Works just fine.

The only thing I do in between is sign the thing, but that shouldn’t make the difference.

The strangest thing to me is that I have the statistics disabled when the application starts. So it’s telling me that the statistics are showing and the main method is never telling it to go away.

But that makes me question… How does the app start without executing the main method.

I’m not great with java, most of my experience comes from the engine. But this just doesn’t seem right to me.

The code in main is only executed on desktop. But that can’t be your issue when it works starting the android app directly from the SDK.


I took a second look, I had moved it into the simpleInitApp method.

I still haven’t found the source of this problem but here is the link to the entire project, and more specifically the project’s class files.

I’ve been looking for a solution to this, but I just don’t understand it.

It could be gui library related. As a test maybe you can add a regular BitmapText to the guiNode or something just to rule that out.


I don’t understand, are you saying add some random text on the app start to see if something is happening?

@BigBob said: @pspeed

I don’t understand, are you saying add some random text on the app start to see if something is happening?


So, to interpret it in more detail since apparently “As a test maybe you can add a regular BitmapText to the guiNode or something…” wasn’t enough.

somewhere in simpleInit
BitmapText test = new BitmapText(guiFont);
test.setText(“This is a test of some text.”);
test.setLocalTranslation(50, 50, 0);

Hopefully that is clear enough.

Just did this.

On the desktop jar in the same build the text shows up. Installing the .apk has no different results. Simply the standard jme statistics.

My only different process throughout this, is I sign the .apk and I install the .apk from my dropbox using the “package manager”

If I want it to work I simply install it from the jme’s test launch by right click the project and setting the config to android.

It will install onto my device show the test text and work perfectly, even if the device is unattached from the pc.

The app will work as intended, as if it were installed on the device as any other app.

Ok, if the stats show up and the bitmap text as I pasted doesn’t… then it isn’t really running your code for some reason.

The stats are just bitmap text and they use the same font I suggested. So the only thing I can think of that could be going wrong is that the simpleInit() with the test text just isn’t being run.

That’s what I was thinking, but that makes me question, why is it being run on the debug .apk but not in the dist .apk?

You are welcome to try and build the project yourself as it is on github to see for yourself.

But to me this is a strange problem.

What device?
What Android OS version?
What target deployment version?

Have you tried running a new application with nothing other than what @pspeed suggested?
Or are you running this in your app?


How are you adding dependencies to your project?

And… for @anyone

Can anyone verify that project dependencies are being packaged up properly when running a final build?

I just tested installing 2 different unsigned apps I created.

1 A new JME project
1 A full game using tonegodGUI

Both installed and ran fine.

I’m using:

An ASUS Transformer TF101
Android 4.0.3
Target deployment: 2.2

Maybe the issue is related to the app signing?

EDIT: Also make sure your target deployment isn’t > your devices android version.

When you say “you compile it to apk, then sign it”… That doesn’t sound right. To get a distribution apk the normal way you need to set your keystore settings in the android properties file (Important Files node) and then clean&build the project (not run it). The correct apk is copied to the dist folder of your main project (theres multiple apks created at certain points).


That seems to have solved it!

By putting my info into the android properties file it worked.