Android Could Not Resolve Error
Android could not resolve error#
If you are sure there are no spelling errors in your dependency and the project is hosted in the expected repository, check the Gradle wrapper and repository configuration next.
Common messages include:
Failed to resolve ...Unable to compilePeer not authenticated
These notes came from Android Studio 1 and 2 era projects, so treat them as historical troubleshooting steps for old codebases. For a modern project, first check the Android Gradle Plugin and Gradle compatibility matrix in the Android documentation.
Checks#
- Confirm the dependency coordinates are correct
- Confirm the repository is declared in the right place. Older projects usually used
allprojects.repositories; newer projects often usedependencyResolutionManagementinsettings.gradle - Confirm the Gradle wrapper version is compatible with the Android Gradle Plugin version
- Check whether the dependency is served from Maven Central, Google Maven, JitPack or a private repository
Wrapper refresh#
If the wrapper is too old for the project, change distributionUrl in gradle-wrapper.properties to a compatible Gradle distribution.
Then run a Gradle wrapper task from the command line:
cd ~/AndroidStudioProject/myproject/myapp
./gradlew tasks
If this works from the command line but not Android Studio, invalidate caches and re-import the project.