Home » Android » android – Gradle 'ProjectName' project refresh failed – Error: Already seen Doctype

android – Gradle 'ProjectName' project refresh failed – Error: Already seen Doctype

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m going mad! I’ve already searched and tried everything (google and stackoverflow) but nothing seems to help.

I’m trying to open (tried also to import) a slidenerd project on Github (http://github.com/slidenerd/materialtest) to Android Studio 1.2.1.1 with Gradle 2.2, but what I got is this annoying error!

Gradle ‘ProjectName’ project refresh failed

Error: Already seen Doctype

Can you help me to understand what can I do to solve?

This is my Gradle console log:

Executing tasks: [:]

Configuration on demand is an incubating feature.
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.0.1/lint-24.0.1.pom

[Fatal Error] lint-24.0.1.pom:3:10: Doctype già presente (means Already seen).

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘MehdiApp’.

    Could not resolve all dependencies for configuration ‘:classpath’.
    Could not resolve com.android.tools.lint:lint:24.0.1.
    Required by:
    :MehdiApp:unspecified > com.android.tools.build:gradle:1.0.1
    Could not parse POM https://jcenter.bintray.com/com/android/tools/lint/lint/24.0.1/lint-24.0.1.pom
    Doctype già presente.

  • Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

BUILD FAILED

Total time: 5.331 secs

How to&Answers:

network might be the reason.
i changed my vpn network then gradle build was successful.

Answer:

It happened to me when I had two google repositories and gradle:3.0.0 as dependencies in build.gradle file :

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
}

That was an obvious mistake. So I removed maven part and changed com.android.tools.build:gradle:3.0.0 to com.android.tools.build:gradle:3.0.1.

This solved my problem.

Answer:

Be sure in your build.gradle (project) only used jcenter() as repository resource not maven or mavenCentral.

Answer:

None of the above solutions worked for me. For me the fix was changing the gradle home (.gradle) to a new location