Could not resolve all artifacts for configuration ':classpath'.

Github pulled from a project, not run, in accordance with normal logic

1, the first change rootProject next build.gradlefile

classpath 'com.android.tools.build:gradle:x.x.x'  // 版本和你新建项目一致

2, in the modified gradle-wrapper.propertiesfile distributionUrlvalues corresponding to the same value with the new project

After performing the above steps, it is supposed to be, but still error

A problem occurred configuring root project 'xxxxxxx'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > Connect to repo.jfrog.org:443 [repo.jfrog.org/35.153.64.121, repo.jfrog.org/52.72.179.201] failed: Connection timed out: connect

It is estimated that the project is too old

Contrast a bit new projects in rootProject under build.gradlechanges in the file are as follows

buildscript {
    repositories {
        jcenter()
        mavenLocal()   // 添加
        google()    // 添加
    }
    //......
    }
}


allprojects {
    repositories {
        jcenter()
        mavenLocal()  // 添加
        google()  // 添加
    }
}

Add the code in the corresponding position again rebulid click on it, if you encounter a problem you can try the above, do not necessarily apply to all projects, best wishes!

Reproduced in: https: //www.jianshu.com/p/5a2f8020f8c6

Guess you like

Origin blog.csdn.net/weixin_33912638/article/details/91165135