错误:找不到com.android.tools.build:gradle:3.5.2

时间:2019-12-03 05:40:01

标签: java android android-studio gradle

ERROR: Could not find com.android.tools.build:gradle:3.5.2.
Searched in the following locations:
  - 

https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom   -

https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.jar   -https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom   -https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.jar     要求:         项目:     打开文件

ext {
    var = '3.5.2'
   var1 = '3.5.2'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
    google()
    jcenter()

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

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

allprojects {
     repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我们在运行项目时从android studio中收到了此错误 我们使用了在线和离线模式,但是它们并不能正常工作 这个错误使我感到困惑

以下代码与包装器有关

ext {
var = '3.5.2'
var1 = '3.5.2'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

     buildscript {
     repositories {
      google()
      jcenter()

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

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

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

3 个答案:

答案 0 :(得分:0)

当您尝试加载旧项目时,基本上会出现此问题。据我所知,最好的解决方案是逐个下载链接,该项目正在显示并同步它。检查构建Gradle文件中是否有任何过时的依赖项。 检查您是否有

  

google()

项目中的回购。确保在依赖项中找到此行。

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

答案 1 :(得分:0)

执行以下步骤:

  1. 将以下代码复制粘贴到<loc><a href="http://www.sample.com">http://www.sample.com</a></loc> Project文件中:
build.gradle
  1. // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.5.2' } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 清除项目
  2. Build > Clean Project重建项目
  3. Build > Rebuild Project进行项目
  4. 然后,Build > Make Project

答案 2 :(得分:0)

我在Linux(ubuntu)上也遇到了这个问题

我尝试了不同的方法,但是问题仍然没有解决。

最后,我删除 /home/(user)/.gradle目录并重新启动Android Studio,此错误已解决。

相关问题