ERROR: Could not find com.android.tools.build:gradle:3.5.2

前端 未结 3 1688
旧巷少年郎
旧巷少年郎 2021-01-15 20:31
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/a

相关标签:
3条回答
  • 2021-01-15 20:38

    Follow these steps:

    1. Copy paste the below code into Project level build.gradle file:
    // 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
    }
    
    
    1. Clean your project from Build > Clean Project
    2. Rebuild you project from Build > Rebuild Project
    3. Make Project from Build > Make Project
    4. Then, File > Invalidate Caches/Restart
    0 讨论(0)
  • 2021-01-15 20:41

    I also had this problem on Linux (ubuntu)

    I tried different ways but the problem still didn't work out.

    Finally, I remove /home/(user)/.gradle directory and restart Android Studio and this error fixed.

    0 讨论(0)
  • 2021-01-15 20:59

    This problem basically occurs when you are trying to load an old project. The best solution as of my knowledge is to download the links one by one, the project is showing and sync it. Check out the build Gradle files for any outdated dependencies. Check out if you have

    google()

    repo in your project. Make sure you find this line in your dependencies.

    dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
        }
    
    0 讨论(0)
提交回复
热议问题