Flutter build fails: 'Could not resolve all artifacts for configuration :app:debugRuntimeClasspath'
Your Flutter project can't find a dependency (usually a local .aar or .jar) during debug build. Quick fix: check your local repo path or clear Gradle cache.
Quick answer (for the impatient)
Run flutter clean, then cd android && ./gradlew cleanBuildCache, then flutter pub get. If that doesn't work, check your pubspec.yaml for any local path dependencies pointing to nonexistent folders. The real culprit is almost always a missing local dependency or a stale cache.
Why this happens
I first saw this error back in Flutter 2.8 and it still pops up in 3.x versions. The error means Gradle can't find an artifact that your app needs — usually a local .aar or .jar file referenced in your project's dependencies. This often happens when you clone a repo from GitHub and someone committed a broken path, or when you upgrade Flutter and the cache gets corrupted.
You'll see something like this in your terminal:
Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Could not find :some-library:1.0.0.
Required by:
project :app
It's infuriating because the error doesn't tell you which file is missing. But I've learned the pattern: look for local dependencies first.
Step-by-step fix (most likely to work)
- Clean everything
Runflutter clean. This wipes the build folder. Then deletepubspec.locktoo — yes, really. It forces a fresh resolution. - Clear Gradle caches
Runcd android && ./gradlew cleanBuildCache. If you're on Windows, usegradlew.bat cleanBuildCache. This clears the Gradle artifact cache where broken dependencies linger. - Check pubspec.yaml for local path deps
Open yourpubspec.yamland look for any dependencies that usepath:like this:
Verify that the target folder actually exists and contains a validdependencies: my_local_lib: path: ../some-relative-pathpubspec.yamlorandroid/folder with build files. I've wasted hours because a teammate moved a folder and didn't update the path. - Run pub get again
flutter pub get— it rescans all dependencies and updates the Gradle files. - Build one more time
flutter build apk --debugor whatever your target is. Should work now.
If the main fix doesn't work (alternative fixes)
Check your Android Gradle Plugin version
This error sometimes triggers when your android/build.gradle has a mismatched AGP version. I've seen it with AGP 7.0+ and older Flutter versions. Open android/build.gradle and make sure com.android.tools.build:gradle:7.x matches what your Flutter SDK expects. For Flutter 3.x, use 7.0.4 or 7.3.0 — 7.4.0+ can cause issues.
Add the missing repository
If the artifact is from a private Maven repo (like JitPack or your company's), you might need to add the repo URL in android/build.gradle under allprojects/repositories. Example:
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Force Gradle to download fresh artifacts
Delete ~/.gradle/caches/ (on macOS/Linux) or C:\Users\YourName\.gradle\caches (Windows). Then rebuild. This is nuclear — it'll make the next build slow, but it fixes cache corruption every time.
How to prevent this
Stop using relative paths for local dependencies in shared projects. Instead, publish your local library to a private repo (like Artifactory or GitLab Package Registry) and reference it by version. If you must use paths, add a pubspec.yaml check in your CI that validates all paths exist before building.
Also, add pubspec.lock to your .gitignore if it isn't already — it's not standard for Flutter apps, but for teams, it reduces these resolver errors. And always run flutter clean after upgrading Flutter or changing dependencies.
One more thing: if you're using Android Studio, sometimes its cache gets out of sync. Hit File > Invalidate Caches / Restart. That's saved me twice this year alone.
Was this solution helpful?