Android rebuilds all contents of Resources folders when doing a build.

Related Threads: Build time in 5.3.X - Unity Engine - Unity Discussions
Android Build Time Significantly Longer Than iOS - Unity Engine - Unity Discussions

We’re working on a very large project and have several GB of assets inside of the Assets/Resources folder.

When building a package for Android, towards the end of the build process it will go through and re-build all assets inside of the Resources folder.

We’ll get a message like this: “Building Asset - 01d01c81243522d40ab” and for a project as big as ours, it will take 30-40 minutes each time and this triggers every time we need to deploy to an Android device.

I’ve created a test project to prove the theory and it builds the apk almost instantly without a Resources folder present. When I add a chunk of data to the Resources folder, it triggers the rebuild every time we build an apk.

When building for other platforms like PC, it doesn’t do this.

I’m assuming the PC version is using the version of the resources it built when opening the project/importing the resources for the first time. I don’t understand why building for Android doesn’t do the same thing.

This is on the latest version of Unity: 5.3.4p4. I’ve also tested in the Beta version (5.4.0b18) and it does the same thing. (also tried different texture formats)

Any light shed on this would be greatly appreciated as it’s slowing down our development speed immensely.

Alex

Simple answer don’t use the resources folder. Contents are bundled at build time, and re-indexed at app launch. To improve build / startup time don’t put contents in it.

1 Like

Thanks for the reply zombiegorilla. I’ve been doing more testing and is 100% caused by the Resources folder. Unfortunately I think it’d be such a big job to switch away from using it this way now.

I just don’t quite understand why it has to rebuild all the assets on build for Android but not other platforms. I would expect it to use a cached version.

It never caches between platforms, but it will go much faster if don’t switch platforms. Your pc builds will be faster because you are probably in pc mode. When you build to a different target it has reimport. You can speed up things if you use a cache server.

It rebuild the assets no matter when when building an apk. I think this is the bug. If I do an entire build and then do another straight after without changing anything, it will rebuild all assets in Resources folder each time.

Right, that is how it works. Are you staying in android mode, (switching platforms first) or just selecting android and pressing build?

I’m staying in Android. Literally just pressing build. It will build the scene and then re-build all assets in resources folders. Once finished 30+ minutes later, I’ll press build again without changing anything else. It will then do the exact same, re-building all the assets it just build.

It’s easy to replicate. Just create a new project with lots of textures and put them in a Resources folder and then build an Android apk.

Yup, that is one of the downsides of using the resources folder like that. It essentially makes bundles from that content. You said you have several GB of data, it is going to take a while.

I think we’re just going to have to try and remove as much data as possible from the resources folders to improve build times. Thanks for your help zombiegorilla :slight_smile:

It will also improve other things, including game launch speed. But, refactoring is never much fun. ;). Good luck!