同事扔给我一个项目,刚开始报错
Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:<ul><li>The project 'CarJniDemo' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
<a href="fixGradleElements">Upgrade plugin to version 2.3.3 and sync project</a></li><li>The project 'CarJniDemo' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
将下面代码
allprojects {
repositories {
google()
jcenter()
}
}
改为
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
问题接踵而来
Error:Cause: buildToolsVersion is not specified.
build.gradle中没有buildToolsVersion
buildToolsVersion "26.0.2"
问题解决