Android Zenject app startup time takes a long time

Hey there!
My game’s loading time is taking forever and it keeps getting longer by the time of adding new features.
I am using Zenject as the DI framework and the backbone of my game’s architecture.
I realized that the moment when the Project Context is getting instantiated, the spike occurs.
After profiling, I came up with this:

It seems something related to loading things into memory is taking a long time.
On my device, Xiaomi mi 11 lite, it takes about 8 seconds. (the app freezes and does not respond to the input).
On a lower-end device like Galaxy A7, it takes about 25 seconds and it feels like the game is broken…


Edit on October 2024:
So, after a fairly long time, I rcvd some emails notifying me about some ppl answering my question here!
Just came to say that it didn’t have anything to do with Zenject (or I couldn’t find it).
We tried to optimize our assets (pre-loaded ones) and the loading time decreased to a reasonable amount.

1 Like

In my case, the issue was caused by the change in the Gradle BUILTIN_NOCOMPRESS option when upgrading from Unity 2020 to 2021. I suspect the problem occurred in an environment where ScriptableObjects were bound as a Global Installer. According to Unity’s documentation, regenerating or modifying the Gradle file resolves issues caused by this excessive compression.

Have you tried looking at the Asset Loading and File Access modules or checked by selecting the individual loading samples’ metadata what assets they are marking up the loading time for?

I’m experiencing the same problem. Did you solve it?

isn’t this expected from a heavy di framework like zenject (I assume you’re using extenject, actually)?