Android build takes forever

I am rebundling a project that was made a while ago and haven’t been bundled for at least a year or so. So far I have only bundled for Android, but bundling takes forever, and since the feedback in editor isn’t very verbose it is hard to determine why. Could some setting have been added or anything like that to explain this behaviour?
The game has a lot of sprites so I am suspecting it might have something to do with that?

Do you use native extensions?

No, I don’t use any native extensions

Can you send screenshots of the error and the list of libraries?
Try to delete the .internal folder and click Fetch libraries

It actually just finished after over two hours of bundling, so there is no error. Still it would be nice to know if there is anything I can do that will speed things up - or is it supposed to take this long? I don’t recall it ever did before.

I think it’s because you have a lot of atlases and use some heavy texture compression that takes too long.
Pls, take a look this post: Texture Management in Defold

4 Likes

Some of my projects also have huge bundle times. It is because of the compression types chosen within texture profiles, some take longer than others. Generally the best compression takes the longest without much extra gain above the second best. It’s possible some things changed since you last bundled your project.

This reminds me of something I’ve wanted for those who have big projects they bundle often. It would be nice for us to have some kind of compressed texture cache so that if the source files do not change the cached versions of the compressed bundles can be used instead. And then have the cache stored in a folder that is not reset every time a new platform build is done. So if you only change a single atlas of a platform it’s only that atlas that is recompressed and not the entire project.

1 Like

Wow, two hours. It must be texture compression. Are you using it in your project Johan?

I am actually a bit unsure. If I look in File->Preferences, “Enable Texture Compression” is not checked, but there is a texture compression asset in the project and it is referenced in game.project.
The profile has two platforms: Generic and Android.
Generic has “Rgba”, “Normal”, “Default” as settings.
Android has “Rgb etc1”, “Normal”, “Default” as settings.

Well, if there is a setting for Android in your texture profile file it seems like it is being used since it’s taking so long. But I’m a bit confused if the “Enable Texture Compression” checkbox is not checked. Is it picking up the texture profile setting anyway?

It sure looks like the editor always enables texture compression when bundling: https://github.com/defold/defold/blob/dev/editor/src/clj/editor/pipeline/bob.clj#L167

1 Like

I turned on texture compression in the editor, which makes building take forever - so I guess that precompresses textures while building instead of doing it in bundling?

Generic has “Rgba”, “Normal”, “Default” as settings.
Android has “Rgb etc1”, “Normal”, “Default” as settings.

I have never seen it take that long with a “Normal” settings either. Is the project huge? Like huge huge.

It is not huge per se, but it has a lot of atlases

How many? One of my project I work on have (according to the build report) over 60 atlases for in total 64 MB uncompressed (36 MB compressed) texture data. The project builds under 20 min, with webp texture compression. I presume the compression time grows O(N) with the amount of data so there must be an incredible amount of textures :open_mouth:

2 Likes

Added https://github.com/defold/defold/issues/4821

This should be a fairly simple issue to fix if someone wants to take a stab at messing with some Clojure

Ok, so uploaded a build report from a build I just made that took over 2 hrs to here.
Here is also the texture profile since @Pkeod requested it in another thread:

 path_settings {
  path: "/assets/graphics/**/*.atlas"
  profile: "Default"
}
profiles {
  name: "Default"
  platforms {
    os: OS_ID_GENERIC
    formats {
      format: TEXTURE_FORMAT_RGBA
      compression_level: FAST
      compression_type: COMPRESSION_TYPE_WEBP
    }
    mipmaps: true
    max_texture_size: 0
    premultiply_alpha: true
  }
  platforms {
    os: OS_ID_ANDROID
    formats {
      format: TEXTURE_FORMAT_RGB_ETC1
      compression_level: NORMAL
      compression_type: COMPRESSION_TYPE_WEBP
    }
    mipmaps: true
    max_texture_size: 0
    premultiply_alpha: false
  }
}

Would it be possible to get access to the project and do some measurements? (bjorn@defold.se). If not then I’ll go ahead and try to repro using a bunch of random textures.

I’ll zip it and send it to you. Thanks!

3 Likes