Why is my Android build failing with a 504 Gateway Timeout when resolving Maven/Sonatype dependencies?
Last updated: July 9, 2026
Context
When running an Android build, you may encounter a failure similar to the following:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportRelease'.
> Could not resolve all dependencies for configuration ':app:releaseCompileClasspath'.
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.9.23.
> Repository maven is disabled due to earlier error below:
> Could not resolve com.google.mlkit:barcode-scanning:17.1.0.
> Could not get resource 'https://oss.sonatype.org/content/repositories/...
> Could not GET 'https://oss.sonatype.org/content/repositories/...
Received status code 504 from server: Gateway Time-outThis error occurs when your Gradle configuration references the legacy Sonatype OSS repository (oss.sonatype.org), which has been permanently shut down and is no longer available.
Answer
This is not a build infrastructure issue — the root cause is that the Sonatype OSSRH legacy repository (oss.sonatype.org) has been deprecated and decommissioned. Requests to this server now return a permanent 404 Not Found response. You can read the official announcement here: https://central.sonatype.org/pages/ossrh-eol/
To resolve this, update your root Gradle file to remove references to the dead repository and ensure the correct repositories are used:
Open your root-level
build.gradlefile.Look for any explicit references to
oss.sonatype.orginside yourbuildscriptorallprojectsblocks, for example:maven { url "https://oss.sonatype.org/content/repositories/..." }Delete any such lines referencing
oss.sonatype.org.Make sure
google()andmavenCentral()are present and listed at the top of your repository blocks:repositories { google() mavenCentral() // other repositories... }
Note: The broken repository URL may sometimes be hidden inside a third-party library's internal configuration rather than your own code. In that case, adding the repository block override in your root Gradle file will intercept and effectively ignore the dead repository.