[SOLVED] Android app immediatly closes on startup

Hey! I am really frustrated and that is why I am coming to the forum to write this.
I have developed a small game and wanted to test the release build on android. The problem is, that when I open the app on my phone, there is a short black screen, and it then closes instantly.

I have searched the internet far and wide, digged through my game.project files, looked into the adb logcat logs, scoured the APK file structure and here is what I have found.

Btw, my problem is still not fixed; help would be very much appreciated.


adb logcat
I have run adb logcat and opened my app to see if the log shows any errors. It turns out, no! The app is launched and then killed with no apparent errors.
I have asked ChatGPT, and it says that it might be because my assets are not loaded.


APK file structure
I have then looked into the file structure of my APK file. As ChatGPT pointed out, there should be an assets folder, of which there is none. I put the assets folder in “Bundled resources” and in “custom resources” in my Defold project, but to no avail.


My game.project file looks good, and the debug build works just fine. Only the release build doesn’t work, and I do not know why.

Please help!

adb_log.txt (Line 291 to 1153): App launch to kill
game.project
app.apk

adb_log.txt (384.7 KB)

game.project.txt (1.5 KB)

app.apk.zip (1.7 MB)



SOLUTION:

I had turned on “Contentless Bundle” in the Bundle Settings in the editor. When I built the app, the project was built without content.

I turned it off, and then I also had an assets folder in my APK. It launched just fine.

Sometimes it’s the little things…

Hello and welcome!
Can you provide more information how you make an Android build? Via Editor or via Bob? Which parameters are you using (without sharing sensitive information)?

and the debug build works just fine. Only the release build doesn’t work, and I do not know why.

There are quite few differences between a debug and release build.
This leads to the question: are you using string representations of hash values?

Also, if possible, it would be beneficial if you could share the actual test project ? (not just the build)

Don’t trust anything ChatGPT says. But yes, there should be an assets folder containing the game resource archive (game.darc etc). I would be surprised if there is none. How did you “look into the file structure of your APK”? It should be enough to change extension to .zip and unzip it. In the root there should be folders META-INF, lib, res, assets and some files such as classes.dex and AndroidManifest.xml.

The fact that the attached .apk doesn’t have any assets is very suspicious to me. I have no idea why that would happen.

I noticed that you only bundled for armv7 (32-bit). But that shouldn’t be a problem as far as I know.

Which OS are using? Windows?

It would be interesting to know if a release build for another platform works. If you are developing on Windows, please try to bundle a release build for Windows. Is it working or not? Probably not since you are missing the assets folder.

I used Android Studio’s feature where you can drag the APK file into it.

I am using macOS Sequoia 15.1. I have built for macOS and I also cannot open that app.

I am using the editor and bundle for Android

See the bundle settings:

contentless?

2 Likes

Hmm, ok. I’m very interested in finding out what’s going on here. Are you able to share the app with me so that I can take a look? (bjorn@defold.se)

Here is my project!

how did I miss that?
wow. but the app now lauches

why does this button exist?

1 Like
1 Like

Nice catch @selimanac !

1 Like