Why is my Gradle build taking longer than expected or failing to resolve dependencies on Codemagic?
Last updated: October 7, 2026
Context
You may notice that your Android build is taking significantly longer than usual, or that it fails with a Gradle dependency resolution error such as:
Could not resolve all files for configuration '<module>:detachedConfiguration2'
This can happen intermittently due to temporary issues with external dependency repositories, or it may be caused by misconfigured repository sources or missing Gradle caching.
Answer
If your build is slow or failing due to dependency resolution issues, try the following steps:
Retry the build. Dependency resolution failures can sometimes be caused by temporary outages in external repositories. Retrying the build may resolve the issue.
Check your repository configuration. Make sure all modules include
google()andmavenCentral()as repositories. If your project is still usingjcenter(), it is recommended to migrate away from it, as it is no longer actively maintained.Verify the build works locally. Ensure your project builds successfully on your local machine before running it on Codemagic.
Match local and CI environment versions. Make sure the Gradle version and Android Gradle Plugin version used locally match what is configured in your Codemagic workflow. Mismatches can cause builds to succeed locally but fail on CI.
Enable Gradle caching. If caching is not enabled for your workflow, enabling it can significantly reduce build times and reduce reliance on external dependency repositories on subsequent builds. You can find setup instructions in the Codemagic caching documentation.