6

After upgrading to androidstudio 3.0 gradle stopped working:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.

Could not resolve com.android.support:appcompat-v7:26.1.0. Required by: project :app

Could not resolve com.android.support:appcompat-v7:26.1.0. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'. Connect to dl.google.com:443 [dl.google.com/172.217.22.110] failed: Connection timed out: connect Connection timed out: connect

I have checked the proxy and it works.

This is a new project, nothing was changed from what the android studio wizard generates.

Thanks for your help.

Telmo M
  • 69
  • 1
  • 1
  • 4
  • It's strange that creating a new fresh project, without any activity or class generates something that doesn't work – Telmo M Oct 31 '17 at 12:30
  • Make sure that Gradle is not running in offline-mode. Go to settings / gradle and uncheck the "Offline work" checkbox. After Gradle has synced you can set it to offline-mode again for faster builds. – Andreas Bergström Jan 29 '18 at 14:26

2 Answers2

10

Try adding Google maven repository into app's build.gradle file:

repositories {
    maven { url "https://maven.google.com" }
}
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • Thanks, But This is a project created from a template, In my original project this didn't work. I'm reinstalling everything now. Let's see... – Telmo M Oct 31 '17 at 17:44
  • I just quit. Unistall Android Studio and the SDK, installed everything again. Created a simple App with no activity, after a few SDK updates, bingo, it works. ??? Now I have to add all my previous files to it. – Telmo M Oct 31 '17 at 18:37
  • 2
    Had the same issue at work. Turns out the company network firewall policy was to blame. I was able to easily build the app when connected to my home wifi. – Lone Ronin Jan 25 '18 at 20:04
  • Brand new project from one of Android Studio's templates and this was my solution. I didn't have to reinstall anything. – rob5408 Jun 11 '18 at 03:40
  • Thank you sooooo much! I added your solution and removed the line *maven { url "https://clojars.org/repo/" }* and the project was building again! – VladimirVip Feb 12 '20 at 00:10
0
  1. Try adding maven support in gradle file and try to rebuild
  2. If step 1 won't work, remove gradle from your project root folder and rebuild your project again.
hemandroid
  • 568
  • 4
  • 12