Apps Created with bob.jar crash

I’m trying to figure out a way to bundle a project on my phone when a computer is unavailable. I’m trying to use Github and bob.jar to do this. However, whenever I create a bundle with bob.jar, the app immediately crashes. It crashed on both android and Windows. Even when I took bob to my computer, the app still crashed. Bundling in the Defold app works just as normal.

this is what I’m running:
java -jar bob.jar --platform armv7-android --archive build bundle -bf apk --bo ./bundles/android --build-server https://build.defold.com --variant debug --binary-output ./build/android/armv7-android -tc true clean resolve

This is the logcat that comes out:

2023-07-05 19:49:00.418  7631-7678  defold                  mchlkpng.mpcreator                   I  INFO:ENGINE: Initialised sound device 'default'
2023-07-05 19:49:00.425  7631-7631  ViewRootIm...dActivity] mchlkpng.mpcreator                   V  updateAppliedLetterboxDirection, direction=0, Caller=android.view.ViewRootImpl.handleDispatchLetterboxDirectionChanged:13665
2023-07-05 19:49:00.431  7631-7631  ViewRootIm...dActivity] mchlkpng.mpcreator                   V  updateAppliedLetterboxDirection, direction=1, Caller=android.view.ViewRootImpl.handleDispatchLetterboxDirectionChanged:13665
2023-07-05 19:49:00.450  7631-7631  InputMethodManager      mchlkpng.mpcreator                   D  startInputInner - Id : 0
2023-07-05 19:49:00.561  7631-7678  hw-ProcessState         mchlkpng.mpcreator                   D  Binder ioctl to enable oneway spam detection failed: Invalid argument
2023-07-05 19:49:00.566  7631-7678  BLASTBufferQueue        mchlkpng.mpcreator                   I  [ViewRootImpl@9517a60[DefoldActivity]#0](f:0,a:0) onFrameAvailable the first frame is available
2023-07-05 19:49:00.566  7631-7678  BLASTBufferQueue        mchlkpng.mpcreator                   D  [ViewRootImpl@9517a60[DefoldActivity]#0](f:0,a:1) acquireNextBufferLocked size=1555x720 mFrameNumber=1 applyTransaction=true mTimestamp=1324834326959889(auto) mPendingTransactions.size=0 graphicBufferId=32774895435776 transform=7
2023-07-05 19:49:00.573  7631-7678  defold                  mchlkpng.mpcreator                   W  WARNING:INPUT: No gamepad map found for gamepad 0 (Virtual). The raw gamepad map will be used.
2023-07-05 19:49:00.573  7631-7678  glfw-android            mchlkpng.mpcreator                   V  handleCommand (main thread): APP_CMD_GAINED_FOCUS
2023-07-05 19:49:00.585  7631-7678  defold                  mchlkpng.mpcreator                   D  DEBUG:SCRIPT: hi
2023-07-05 19:49:00.586  7631-7678  defold                  mchlkpng.mpcreator                   E  ERROR:SCRIPT: attempt to call a userdata value
2023-07-05 19:49:00.586  7631-7678  libc                    mchlkpng.mpcreator                   A  ../src/gameobject/comp_script.cpp:723: dmGameObject::InputResult dmGameObject::CompScriptOnInput(const dmGameObject::ComponentOnInputParams &): assertion "top == lua_gettop(L)" failed
2023-07-05 19:49:00.586  7631-7631  DecorView               mchlkpng.mpcreator                   I  notifyKeepScreenOnChanged: keepScreenOn=false
2023-07-05 19:49:00.588  7631-7678  defold                  mchlkpng.mpcreator                   I  INFO:CRASH: Successfully wrote Crashdump to file: /data/user/0/mchlkpng.mpcreator/files/_crash
2023-07-05 19:49:00.588  7631-7678  defold                  mchlkpng.mpcreator                   E  ERROR:CRASH: CALL STACK:
                                                                                                    
                                                                                                    #00 pc 0x00002ee408 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #01 pc 0x000005e188 ...droid.runtime/lib/bionic/libc.so <unknown>+0
                                                                                                    #02 pc 0x00000635f6 ...droid.runtime/lib/bionic/libc.so abort+137
                                                                                                    #03 pc 0x000006389a ...droid.runtime/lib/bionic/libc.so __assert2+25
                                                                                                    #04 pc 0x00000cbb78 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #05 pc 0x00000c2df8 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #06 pc 0x00000a3188 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #07 pc 0x00000a3808 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #08 pc 0x00000a42fc ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #09 pc 0x000009f8a4 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #10 pc 0x000029c8d0 ...UoPvg==/lib/arm/libMapCreator.so <unknown>+0
                                                                                                    #11 pc 0x00000ad484 ...droid.runtime/lib/bionic/libc.so <unknown>+0
                                                                                                    #12 pc 0x000006459e ...droid.runtime/lib/bionic/libc.so <unknown>+0

Here is the crash dump:
crash.txt (49.2 KB)

Any ideas for the cause? Thanks.

This looks suspicious. What are you doing in the script? Also, does it matter if you bundle a completely empty project?

1 Like

That’s the problem, I have no idea what this means. This error doesn’t appear in any other builds. I do suspect that the line under it may have something to do with it, though.

I built an empty project with bob.jar, and it runs fine. Actually, the same project runs fine on windows now. I added the same native extensions, no problem. However, when I build the app from Defold to to the new app with the extensions, it crashes immediately, but the Defold console doesn’t show any errors.

I tried checking if a lua module was using a mobile-incompatible extension unquarantined, since that was a problem I had in a different project. However, then it showed the error and where it came from, and I was able to fix it quickly. I don’t see any such occurrence in this situation.

Which extensions are you using? It looks like there might be some extension code running which messes up the Lua stack. It could be that the order in which the extensions are run is different when built on GitHub Actions vs when built locally and this could explain why you are only seeing it in the CI builds.

If you don’t mind, please share the project with us.
Zip up the project (without the ./build .git/ .internal folders) and upload it here (or in a DM if it’s sensitive data)

(or perhaps invite to source repo)

Actually, it appears it doesn’t work on the Windows version (I was using an outdated version of the app built by defold).

Also, no, I wasn’t running it in Github actions. I don’t want to add bob to the Github repository as the project is pulled to my Onedrive so I don’t really want a big file like that. I just ran it on Github Codespaces, and the bundles produced there didn’t work either.

Here are the extensions:

dependencies#0 = https://github.com/rgrams/rendercam/archive/v1.0.1.zip
dependencies#1 = https://github.com/subsoap/defos/archive/master.zip
dependencies#2 = https://github.com/subsoap/defsave/archive/master.zip
dependencies#3 = https://github.com/britzl/defold-lfs/archive/master.zip
dependencies#4 = https://github.com/britzl/defold-metrics/archive/master.zip
dependencies#5 = https://github.com/defold/extension-websocket/archive/refs/tags/3.0.0.zip
dependencies#6 = https://github.com/britzl/defold-luasocket/archive/refs/tags/0.11.1.zip
dependencies#7 = https://github.com/colyseus/colyseus-defold/archive/0.15.zip
dependencies#8 = https://github.com/Lerg/extension-imageloader/archive/master.zip

The extensions themselves didn’t cause the problem; an empty project with all of these and built with bob worked fine.

Then I suggest you try to track this output down.
Add some prints in your code to see if you can pin point it.

Done (through DM)

Ok, so the ones that I see that could cause problems is extension-websocket and extension-imageloader. How are you using them? When the problem happens?=

defos, defold-luasocket and defold-lfs does also contain native code but I very highly doubt that either of them can mess up the Lua stack.

I’m using extension-websocket for client connection with a colyseus server and extension-imageloader to create new textures/atlases at runtime.

Aside from adding print() statements to pinpoint the error, I also suggest removing the extensions one-by one.

1 Like

Yep, @mchlkpng start stripping down your game until it no longer crashes. Start by eliminating all use of said extensions.

Alright, I’ll be on that.