Android ERROR: Failed to resolve: com.github.****

created at 06-03-2022 views: 4

problem

A good project suddenly fails to run. It may be fine just a moment ago. Once some dependencies are involved, especially the three parties related to com.github.XXX, it cannot be downloaded.

reason

It may be that the location of the maven repository of the Build.gradle of the project is not correct. As for why it was possible before, I don't know, like this:

previous version:

buildscript {
    repositories {

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        mavenCentral()
        maven { url 'https://repo1.maven.org/maven2/' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

current way:

buildscript {
    repositories {

        google()
        jcenter()
//        maven { url 'https://www.jitpack.io' } Drop this one below and you're good to go.
        mavenCentral()
        maven { url 'https://repo1.maven.org/maven2/' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        mavenCentral()
        maven { url 'https://repo1.maven.org/maven2/' }
        maven { url "https://oss.jfrog.org/libs-snapshot" }
    }
}
created at:06-03-2022
edited at: 06-03-2022: