(Correction) Rive dependency looks like it breaks Android apps

EDIT : I must’ve missed something while testing, it’s not admob that breaks the Android apps it’s Rive

EDIT 2 : I went back to Defold 1.8.1, and Rive 1.3.0 and made it work

Hello everyone,

I’m in the process of maintaining my android app that used the admob dependency and I ran into a number of problems to build and bundle it. After spending some time testing I figured out it was probably linked to the admob extension. There are two things :

First thing, when I try to bundle my app I get a failure with this log :

log.txt (1.7 MB)

Second thing, I tried to make a new project and bundle it with the same dependencies. It actually does bundle and I could install it on my device, but, it crashes instantly when I run it. So then I tried to remove each dependencies and it turns out it works when Admob is removed and all other dependencies are there.

I tried multiple versions of the library, from 3.6.0 to 3.4.0 and it is always the same results in both case.

Device is on Android 13, PC is Windows 10 if that helps

You have some AdMob warnings:

upload/extension-admob/src/admob.cpp:316:14: warning: comparison of different enumeration types in switch statement ('enum ExtensionEventID' and 'dmExtension::EventID') [-Wenum-compare-switch]
        case dmExtension::EVENT_ID_ACTIVATEAPP:

But the errors seems to be Box2D related:

ld.lld: error: undefined symbol: b2Body::SetTransform(b2Vec2 const&, float)
>>> referenced by script_box2d_body.cpp:105 (../src/gamesys/scripts/box2d/script_box2d_body.cpp:105)
>>>               script_box2d_body.cpp.2.o:(dmGameSystem::Body_SetTransform(lua_State*)) in archive /var/extender/sdk/3be87d89fd5a93a63f527351fbedb84f8a875812/defoldsdk//lib/armv7-android/libscript_box2d.a

Please provide the following information:

  • Your list of project dependencies
  • Which Defold version you are using
  • Which build server you are using

Edit: My recommendation is to use Defold 1.9.1 (just released), the latest version of all dependencies and make sure to build with https://build.defold.com.

1 Like

The ”event id” warnings is from our code. One enum is generated from the other so they should match. But we should fix it and either ise a single enum or cast it ( in the extension that is)

From the log, it seems be an AndroidManifest.xml merging issue

The part about Box2D is intriguing, I actually exclude the library in my app manifest

        excludeLibs: ["physics","LinearMath","BulletDynamics","BulletCollision","Box2D","record","vpx","profilerext"]

Defold version 1.9.1, engine SHA1 3be87d89fd5a93a63f527351fbedb84f8a875812
I’m not sure about the build server, I didn’t touch anything about it

Dependencies :

https://github.com/rgrams/rendercam/archive/refs/tags/1.0.3.zip
https://github.com/defold/extension-admob/archive/refs/tags/3.4.0.zip
https://github.com/defold/extension-rive/archive/refs/tags/2.4.0.zip

Also I think what @Chung_Xa said makes a lot of sense, I did use the same AndroidManifest.xml file for both my main app and my minimal test that bundles but crashes on start. Is there something that changed in the last few months or so? The last time I had a successful bundle with the same file was on May 13 2024.

We recently updated the scripting parts of Box2D.
You may want to exclude symbol ScriptBox2DExt and library script_box2d

Best option is to compare with a new app manifest, and select Physics = None.

3 Likes

Great news, the game now bundles! However when I try to install the APK on my device I get a “There was a problem while parsing the package” error. Any idea about what could cause that?

No idea. What more do see in the device log.

I investigated more and luckily it was only about the target SDK! So the app sucessfully installs, however it still crashes on start, just like the minimal test I made.

I used logcat, filtering for Errors and found this when trying to start the app :

crash log.txt (680 Bytes)

Does the generated androidmanifest.xml have admob metadata? Missing metadata usually causes instant crash.

<manifest>
  <application>
    <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  </application>
</manifest>
1 Like

Try a debug build and share the log also before the crash

The bundle was Debug mode from the start actually

Okay, I tried getting more out of the E filter, it’s pretty hard there is a lot, and the F filter only have this :

--------- beginning of crash
04-22 17:02:55.015   590   590 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 590 (init), pid 590 (init)
04-22 17:02:55.031   590   590 F libc    : crash_dump helper failed to exec, or was killed
07-06 00:04:45.286  1961  1961 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 1961 (init), pid 1961 (init)
07-06 00:04:45.444  1961  1961 F libc    : crash_dump helper failed to exec, or was killed
07-06 00:05:10.473  4289  4289 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 4289 (init), pid 4289 (init)
07-06 00:05:10.531  4289  4289 F libc    : crash_dump helper failed to exec, or was killed

I noticed that after the crash the app’s process actually stayed alive and was spamming this :

07-26 18:14:12.230  1218  4461 E ANDR-PERF-LM: StatsProvider: stats_nl_error_callback() 115: NL SOC receive error: No such process
07-26 18:14:12.230  1218  4461 E ANDR-PERF-LM: StatsProvider: sendRecvData() 272: nl_recvmsgs failed return=-12
07-26 18:14:12.230  1218  4461 E ANDR-PERF-LM: StatsProvider: getPIDStats() 124: sendRecvData returned error = -4

And so right before what I sent is :

07-26 18:17:00.012  3438  3438 E ReflectUtils: invokeObject
07-26 18:17:00.012  3438  3438 E ReflectUtils: java.lang.reflect.InvocationTargetException
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at java.lang.reflect.Method.invoke(Native Method)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.utils.ReflectUtils.invokeObject(ReflectUtils.java:31)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.utils.DataUtils.isAppInstalledForUser(DataUtils.java:341)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.utils.DataUtils.isHealthAppInstalled(DataUtils.java:326)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.classic.ClassicClockView.filterClassicClockInfo(ClassicClockView.java:178)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.classic.ClassicClockView.updateTime(ClassicClockView.java:316)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.miui.clock.MiuiClockController$1.run(MiuiClockController.java:155)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.os.Handler.handleCallback(Handler.java:942)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.os.Looper.loopOnce(Looper.java:211)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.os.Looper.loop(Looper.java:300)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.app.ActivityThread.main(ActivityThread.java:8503)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at java.lang.reflect.Method.invoke(Native Method)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
07-26 18:17:00.012  3438  3438 E ReflectUtils: Caused by: android.content.pm.PackageManager$NameNotFoundException: com.mi.health
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:254)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:242)
07-26 18:17:00.012  3438  3438 E ReflectUtils:  ... 15 more
07-26 18:17:00.019  3438  3438 E AnimationHelper: updateTime mToAod:false mHasNotification: false, mClockType: classic
07-26 18:17:13.048 27764 27764 E QuickstepAppTransitionManagerImpl: getActivityLaunchOptions iconLoc=Rect(714, 1339 - 895, 1520)
07-26 18:17:13.056  1218  1360 E ANDR-PERF-OPTSHANDLER: Perflock resource /sys/class/devfreq/soc:qcom,cpubw/max_freq not supported
07-26 18:17:13.056  1218  1360 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [6, 6]
07-26 18:17:13.056  1218  1360 E ANDR-PERF-OPTSHANDLER: Perflock resource /sys/class/devfreq/soc:qcom,cpubw/min_freq not supported
07-26 18:17:13.056  1218  1360 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [6, 0]
07-26 18:17:13.059  1218  1361 E ANDR-PERF-LM: MetaMeter: handleAsync() 166: AdaptLaunch Invalid Async
07-26 18:17:13.059  1700  4032 E ANDR-PERF-JNI: com_qualcomm_qtiperformance_native_perf_io_prefetch_start
07-26 18:17:13.059  1218  1361 E ANDR-PERF-LM: MetaMeter: handleAsync() 166: AdaptLaunch Invalid Async
07-26 18:17:13.060  1218  1361 E ANDR-PERF-LM: MetaMeter: handleAsync() 166: AdaptLaunch Invalid Async
07-26 18:17:13.065  1216  4505 E ANDR-IOP: io prefetch is disabled
07-26 18:17:13.067  1218  1360 E ANDR-PERF-OPTSHANDLER: Perflock resource /sys/class/devfreq/soc:qcom,cpubw/max_freq not supported
07-26 18:17:13.067  1218  1360 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [6, 6]
07-26 18:17:13.067  1218  1360 E ANDR-PERF-OPTSHANDLER: Perflock resource /sys/class/devfreq/soc:qcom,cpubw/min_freq not supported
07-26 18:17:13.067  1218  1360 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [6, 0]
07-26 18:17:13.089  1700  2682 E MiuiActivityController: MiuiLog-ActivityObserver: There was something wrong : null
07-26 18:17:13.108  3438  3795 E perf_hint: Session creation failed, mPreferredRateNanos: -1
07-26 18:17:13.109  1218  1361 E ANDR-PERF-LM: MetaMeter: handleAsync() 166: AdaptLaunch Invalid Async
07-26 18:17:13.116 27764 30366 E ActivityManagerWrapper: get all recent tasks force including 2
07-26 18:17:13.117 26100 26100 E Zygote  : process_name_ptr:26100 com.beanguy.rogue
07-26 18:17:13.126 27764 28219 E LauncherAnimationRunner: onAnimationStart
07-26 18:17:13.126 27764 28219 E LauncherAnimationRunner: onAnimationStart:   mode=1   taskId=2   isTranslucent=false   activityType=2
07-26 18:17:13.126 27764 28219 E LauncherAnimationRunner: onAnimationStart:   mode=0   taskId=4359   isTranslucent=false   activityType=1
07-26 18:17:13.126 27764 27764 E QuickstepAppTransitionManagerImpl: startIconLaunchAnimator:launcherClosing=true   iconLoc=Rect(714, 1339 - 895, 1520)
07-26 18:17:13.126 27764 27764 E QuickstepAppTransitionManagerImpl: startOpeningWindowAnimators:iconLoc=Rect(714, 1339 - 895, 1520)
07-26 18:17:13.126 27764 27764 E ClipAnimationHelper: updateSourceStack  mSourceInsets=Rect(0, 90 - 0, 130), mSourceStackBounds=Rect(0, 0 - 1080, 2400)
07-26 18:17:13.127 27764 27764 E ClipAnimationHelper: updateHomeStack  mSourceInsets=Rect(0, 90 - 0, 130), mHomeStackBounds=Rect(0, 0 - 1080, 2400)
07-26 18:17:13.127 27764 27764 E ClipAnimationHelper: updateTargetRect  mSourceRect=RectF(0.0, 90.0, 1080.0, 2490.0)   mTargetRect=RectF(0.0, 0.0, 1080.0, 2400.0)   mSourceWindowClipInsets=RectF(0.0, 90.0, 0.0, 0.0)   mHomeStackBounds=Rect(0, 0 - 1080, 2400)   targetRect=Rect(0, 0 - 1080, 2400)
07-26 18:17:13.127 27764 27764 E QuickstepAppTransitionManagerImpl: startLauncherContentAnimator:isAppOpening=true
07-26 18:17:13.130  1218  1360 E ANDR-PERF-OPTSHANDLER: Cannot open/create foreground cgroup file
07-26 18:17:13.134 27764 28004 E perf_hint: Session creation failed, mPreferredRateNanos: -1
07-26 18:17:13.135 27764 30366 E ActivityManagerWrapper: getRecentTasks: size=1
07-26 18:17:13.135 27764 30366 E ActivityManagerWrapper: getRecentTasks: mainTaskId=4359   userId=0   baseIntent=Intent { act=android.intent.action.MAIN flag=270532608 cmp=ComponentInfo{com.beanguy.rogue/com.dynamo.android.DefoldActivity} }
07-26 18:17:13.186  1218  1361 E ANDR-PERF-LM: MetaMeter: handleAsync() 166: AdaptLaunch Invalid Async
07-26 18:17:13.190 27764 30366 E ActivityManagerWrapper: get all recent tasks force including 4359
07-26 18:17:13.203 27764 30366 E ActivityManagerWrapper: getRecentTasks: size=1
07-26 18:17:13.203 27764 30366 E ActivityManagerWrapper: getRecentTasks: mainTaskId=4359   userId=0   baseIntent=Intent { act=android.intent.action.MAIN flag=270532608 cmp=ComponentInfo{com.beanguy.rogue/com.dynamo.android.DefoldActivity} }
07-26 18:17:13.216 27764 30366 E ActivityManagerWrapper: get all recent tasks force including 4359
07-26 18:17:13.218 27764 30366 E ActivityManagerWrapper: getRecentTasks: size=1
07-26 18:17:13.218 27764 30366 E ActivityManagerWrapper: getRecentTasks: mainTaskId=4359   userId=0   baseIntent=Intent { act=android.intent.action.MAIN flag=270532608 cmp=ComponentInfo{com.beanguy.rogue/com.dynamo.android.DefoldActivity} }
07-26 18:17:13.612 27764 27764 E LauncherAnimationRunner: finish: mFinishRunnable.run
07-26 18:17:13.630  1218  1360 E ANDR-PERF-OPTSHANDLER: Cannot open/create system background cgroup file
07-26 18:17:13.704  1700  2682 E MiuiActivityController: MiuiLog-ActivityObserver: There was something wrong : null

It is true that this code was actually missing from my .xml ! But unfortunately when I fixed it and rebundled it nothing changed. Thanks for trying !

It seems you are using a Xiaomi phone. Try another phone to see if it relates to OS

Hold on. Was it missing? The final Android manifest.xml can be found in the build folder somewhere (i don’t remember exact path now). That final version should automatically include the admob tags.

1 Like

I just realised I probably mixed up the generated one with the provided one. I tried both bundling with and without the code sample from @chemosit inside the provided manifest, and I went to the generated one.

What I see when I include the code bit :

!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="MY ID"/>
<meta-data android:name="android.max_aspect" android:value="2.1"/>
<meta-data android:name="android.notch_support" android:value="true"/>
<activity android:name="com.dynamo.android.DefoldActivity"

What I see when I don’t include the code bit :

<!--  For extension-admob  -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[MY ID]"/>
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION" android:value="true"/>
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" android:value="true"/>

EDIT : I also tried using the builtin Manifest that has a few differences with my custom one but to no avail

I just tried on a Samsung device, same result

Could you please open extension-admob as a Defold project? Does it work?

If I understand well yes it worked. I downloaded the zip file from github, extracted it, opened game.project with Defold, I bundled it in debug mode and I successfully installed it and ran it on my device. I tested some ads and everything is alright.

I re-attempted the empty project with all dependencies just to be sure and I confirm it does also crash on start just like my app so maybe there’s something I need to do that I didn’t I just can’t figure out what with the docs

What if you add these dependencies to the extension-admob example not your new one?