Could not find com.android.tools.build:gradle:3.2.1. in a sample project from github

 ̄綄美尐妖づ 提交于 2021-01-28 09:06:50

问题


I am trying to compile this project: https://github.com/dakatso/SpeexExample

The project as is gives errors during gradle sync (it says something called mipsel-linux-android was not found). I have made changes to the following files:

gradle-wrapper.properties :

#Tue Jul 07 16:26:18 KST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip  

Project level build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        // classpath 'com.android.tools.build:gradle-experimental:0.7.2'        // ORIGINAL
        classpath 'com.android.tools.build:gradle:3.2.1'
        // classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Could not find com.android.tools.build:gradle:3.2.1.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
Required by:
    project :
Add Google Maven repository and sync project
Open File

If I create a new project from scratch I use 'com.android.tools.build:gradle:4.0.0' but for this project nothing seems to work. How can I get this project to compile?


回答1:


You have to add the google() repo.

buildscript {
    repositories {
        google() //<--
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        // classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

allprojects {
    repositories {
        google() //<--
        jcenter()
    }
}

Also check the gradle version.
The plugin 3.2.1 requires at least the version 4.6:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip


来源:https://stackoverflow.com/questions/62770507/could-not-find-com-android-tools-buildgradle3-2-1-in-a-sample-project-from-gi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!