0

I've been developing an Android app for a few months. When I left work last night, everything was fine, but when I returned this morning I had to restart my computer and therefore Android Studio. Now when I attempt to build the project I get the error "Failed to resolve: com.android.support", along with "Grade project sync failed. Basic functionality (e.g. editing, debugging) will not work properly."

I've tried updating to the latest Android Studio version, updating Gradle to the latest version (I used the table in this thread to properly sync the plugin/gradle versions), rolling back to a working version via Git, and switching the google() repository to

maven {
    url 'https://maven.google.com'
}

Here's a screenshot of the Build view showing the error.

And here's a screenshot of the app build.gradle file

"Failed to resolve: com.android.support" has proven to be too generic to find a solution via Google.

possum_pendulum
  • 159
  • 1
  • 4
  • 21

3 Answers3

1

I solved my own problem in a pretty simple way. I created a new project, opened the app-level build.gradle file, added all the extra dependencies from the old project, then replaced the old file with the newly created one. This solved the issue. Upon inspecting the differences between old and new I realized that somehow

android {
    buildToolsVersion '29.x.x'
}

had been added to the old project and it was one version greater than the compileSdkVersion. After Gradle finally synced successfully it notified me to fix the buildToolsVersion, which is now the same as the compileSdkVersion.

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
}
possum_pendulum
  • 159
  • 1
  • 4
  • 21
0

try using invalidate cache/restart option from android studio

Ashok Kumar
  • 1,226
  • 1
  • 10
  • 14
0

When i encounter that kind of error I always do the same routine:

File > Invalidate caches/Restart
Build > Clear Project
Build > Rebuild Project
File > Sync project with Gradle files

I hope that it will help you too. Good luck!

VIAX
  • 94
  • 2
  • 11