Starting 2024 with a fresh motivation to build something great in Android Studio was immediately met with the classic "Gradle Sync" wall. If you've ever spent 3 hours staring at a circle that won't stop spinning, you know my pain.

The Error That Ruined My Day

Everything was working fine until it suddenly wasn't. I tried to sync my project after adding a new dependency, and I was greeted with this beauty:

Build Output Could not find com.android.tools.build:gradle:8.2.0.
Required by:
project :

Possible solution:
- Declare repository providing the artifact, e.g. google(), maven Central()

The Troubleshooting Journey

I checked my settings.gradle. I checked my build.gradle. Everything seemed fine. I clean the project, rebuilt it, invalidated caches—no luck. Then it hit me: Proxy settings.

Since I was working on a university network, the Gradle daemon was trying to connect directly to the internet while the network required a proxy. I had to manually configure the gradle.properties file.

gradle.properties systemProp.http.proxyHost=your.proxy.address
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=your.proxy.address
systemProp.https.proxyPort=8080

Lesson Learned

Never assume the network environment stays the same. If your Gradle sync is failing with "Connection refused" or "Could not find artifact" even when the dependency is clearly correct, always check your proxy settings and the order of your repositories.

Pro tip: Always put google() before mavenCentral() in your repository blocks!