MacroDroid crashed

bewafa

Member
MacroDroid is not opening. Every time I try to open it, I get an error message. I believe this started happening after I attempted to update the app to version 32.2, but the update failed with an error message stating that the package appeared to be invalid

java.lang.OutOfMemoryError: Failed to allocate a 40 byte allocation with 382704 free bytes and 373KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
at com.google.gson.internal.LinkedTreeMap.<init>(LinkedTreeMap.java:5)
at com.google.gson.internal.LinkedTreeMap.<init>(LinkedTreeMap.java:1)
at com.google.gson.JsonObject.<init>(JsonObject.java:6)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:24)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:66)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:40)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:40)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:66)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:40)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:40)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:66)
at com.google.gson.internal.bind.TypeAdapters$29.f(TypeAdapters.java:40)
at com.google.gson.internal.bind.TypeAdapters$29.c(TypeAdapters.java:1)
at com.google.gson.internal.Streams.a(Streams.java:7)
at com.google.gson.internal.bind.TreeTypeAdapter.c(TreeTypeAdapter.java:14)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.c(TypeAdapterRuntimeTypeWrapper.java:3)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.f(CollectionTypeAdapterFactory.java:33)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.c(CollectionTypeAdapterFactory.java:1)
at com.google.gson.Gson.h(Gson.java:21)
at com.google.gson.Gson.i(Gson.java:5)
at com.google.gson.Gson.k(Gson.java:10)
at com.arlosoft.macrodroid.macro.m.Y(MacroStore.java:32)
at com.arlosoft.macrodroid.macro.m.i0(MacroStore.java:179)
at com.arlosoft.macrodroid.macro.m.h0(MacroStore.java:3)
at com.arlosoft.macrodroid.macro.m.g0(MacroStore.java:2)
at com.arlosoft.macrodroid.macro.m.N(MacroStore.java:23)
at com.arlosoft.macrodroid.app.MacroDroidApplication.i(MacroDroidApplication.kt:42)
at com.arlosoft.macrodroid.app.MacroDroidApplication.onCreate(MacroDroidApplication.kt:251)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1224)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7106)
at android.app.ActivityThread.access$1600(ActivityThread.java:271)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8322)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)
 
Last edited:

Jacob L

Moderator (Lawsonator)
OOM is out of memory. You should see if you have enough RAM. There's no info about your device or MacroDroid versions, make sure everything is fully updated
 

bewafa

Member
I've cleared my OOM and I do have enough RAM. But still the app is not opening. I'm running on Xiaomi Redmi power 9, Android 12. And my app version is 5.31.7.
 

Jacob L

Moderator (Lawsonator)
Looks like you'll need to uninstall and start again. Have you made a backup of your macros? If you signed into auto backup then you'll be fine.

If at all you can hit the switch to disable MacroDroid before the crash then do that, you can then share the macros to another device or your internal storage for backup.

It maybe that you created a macro that has an infinite loop or something that eats your RAM.

If you feel confident, you may be able to Debloat your device to free up RAM and make MacroDroid work without data loss, see: https://github.com/0x192/universal-android-debloater

It may also be the phantom processes killer on Android 12, which can be disabled with ADB
 

Jacob L

Moderator (Lawsonator)
I've cleared my OOM and I do have enough RAM. But still the app is not opening. I'm running on Xiaomi Redmi power 9, Android 12. And my app version is 5.31.7.
Have you tried the other APK, that might fix for you
 

Endercraft

Moderator (& bug finder :D)
 
Solution

MacroDroidDev

Administrator
Staff member
I've advised this before, but please stop storing enormous amounts of text in variables. It doesn't matter how much memory your device has, any given app is only allocated a small percentage of this and if you try to store massive amounts of text then you will likely hit out of memory errors at some point.
 

bewafa

Member
I've advised this before, but please stop storing enormous amounts of text in variables. It doesn't matter how much memory your device has, any given app is only allocated a small percentage of this and if you try to store massive amounts of text then you will likely hit out of memory errors at some point.
I later got to know that the problem was not related to variables; instead, the crashes were caused by a macro that used to export macros when MacroDroid closes.
 

Dm114

Well-known member
I've advised this before, but please stop storing enormous amounts of text in variables. It doesn't matter how much memory your device has, any given app is only allocated a small percentage of this and if you try to store massive amounts of text then you will likely hit out of memory errors at some point.
To avoid storing a big amount of data in the MD environment (local and global variables) I store all those big pieces of text in external files and read them and temporarily store them at run time (erasing these variables when closing the macros, of course).
 
Top