24

I've installed Android studio 3.0.1 then tried to build very first app by choosing an empty activity, but I've got this message:

Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly

and the error message like this:

Unable to resolve dependency for ':app@releaseUnitTest/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 parse POM https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom > Already seen doctype.

enter image description here

enter image description here

The first part of log message is like this:

2018-01-03 11:11:12,671 [d thread 8] WARN - ect.sync.idea.ProjectSetUpTask - Already seen doctype. Consult IDE log for more details (Help | Show Log) 2018-01-03 11:11:12,671 [d thread 8] INFO - e.project.sync.GradleSyncState - Gradle sync failed: Already seen doctype.

I've tried some suggested solutions like changing gradle version, update Kotlin plugin(!) and so, but they didn't work.

Any solution?

pooria haddad
  • 795
  • 2
  • 8
  • 24

14 Answers14

12

This problem occurs when the Build Tools Version is not set for the project. You just set the build tools version by following this process...

By opening your project structure [File->Project Structure] and selecting the Build Tools Version from app's property tab in Modules section.

This will add build tools version to your gradle file (Module:app) and re-sync the project.

Mridul Das
  • 133
  • 6
6

The problem caused by my connection. I needed to set proxy to download some components.

pooria haddad
  • 795
  • 2
  • 8
  • 24
  • 4
    Can you be more specific... what components where missing? I continue to have this trouble even after trying the other solutions. – mjash Jan 17 '18 at 13:55
  • @mjash, I too. Help me –  Jul 31 '18 at 02:45
  • For me, It was just a problem for downloading some components and the reason was the issue caused by google itself. So I've just changed my VPN connection and problem solved. But recently I realized that this problem is more common and others have it with different reasons. – pooria haddad Aug 01 '18 at 05:37
  • yep, only VPN helped me to download a necessary library correctly ("inapp-sdk") – Maksim Ryabovol Mar 19 '19 at 09:34
3

For me the issue was one of the external libraries required SDK 28 but android studio didnt have it so it did not work. I installed SDK 28 and the problem was fixed. I saw the problem in the log file it generated

shiv zuh
  • 125
  • 11
2

The error happens under fluctuating network. So at first make sure your connection is stable. Plus, if you are using any VPN check your gradle.properties is configured correctly.

The correct form of VPN connection on gradle.properties is as follows,

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080

My host connection is 127.0.0.1, and its port is 8080 for both http and https.

Just one more thing, make sure adding https (It is mandatory).

Esmaeil MIRZAEE
  • 1,110
  • 11
  • 14
2

I had the same problem when i was upgrading to android studio 3.1.2 and the problem i was using the previous JDK which i installed before 5 years back.

The steps:-

Go to File -> Project Structures -> SDK Location -> JDK Location -> check the 
Option Use embedded JDK (recommended).
Agilanbu
  • 2,747
  • 2
  • 28
  • 33
2

I tried all suggestions, only one works for me:

  • open 'Gradle' tab on right vertical panel
  • right click on project name
  • 'Refresh Gradle Dependencies' and wait background downloading
  • right click on project name again
  • 'Reload Gradle Project' and wait refreshing
Tapa Save
  • 4,769
  • 5
  • 32
  • 54
2

I was also stuck with the same issue for quite few minutes till I figured out the solution:

So you have to visit Gradle Releases and there scroll down a little bit and you will find the plugin version and required gradle version. Make sure you use the latest version of both or the ones which are compatible with each other.

For today I am using :

Android Gradle Plugin Version - 7.0.2

Gradle Version - 7.2

You can update it by navigating to:

> File -> Project Structure -> Project

oyeraghib
  • 878
  • 3
  • 8
  • 26
1

Suddenly My Project showing this Error(Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly). Then i Try to various solutions but not solved.
Then i close the android studio, and open the project location and delete the .idea and .iml file, After deleting this file open the project again on Android studio, after that the project working fine.

Imran Sk
  • 303
  • 5
  • 17
0

I had the same problem, I did download gradle version and used it as a local distribution. Settings/Build,../Gradle/Use local distribution. Else you will have to reinstall all the software.

Master49
  • 61
  • 7
0

The solution is kinda of very simple. It's because the "compileSdkVersion" that you are using in your build.gradle (Module:app) is higher than the SDK installed in your Android studio. Now, what to do? Just go on SDK Manager and download an Api Level higher or equal to your "compileSdkVersion" and you're done

0

Look at the manifest, something may have to go wrong there. In my case I had this label <uses-sdk android: minSdkVersion = "7" android: targetSdkVersion = "15" />, which was from an example. Then the error is displayed, and the correspondent is now updated <uses-sdk android: minSdkVersion = "15" android: targetSdkVersion = "27" />

0

As @oyeraghib said, Visit this link to check the compatibility of your Android Gradle Plugin in comparison with Gradle itself. I was using an older version of both and updated to version 7 in both.

File -> Project Structure -> Project

It may take a while. Wait for it to load.

Tomas Ward
  • 854
  • 6
  • 23
0

change the grade version to the latest one in gradle-wrapper

-2

Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly

Go to gradle scripts -> build gradle(app) -> made following changes:

enter image description here

Finally it works.

  • 6
    Please add a description of what your image/screenshot is about. You should also read about [how to write a good answer](//stackoverflow.com/help/how-to-answer). – Samuel Liew May 22 '19 at 06:09