Error:Cause: buildToolsVersion is not specified.

同事扔给我一个项目,刚开始报错

Error:(6, 0) Gradle DSL method not found: 'google()'
Possible causes:
  • 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 projecta>
  • The project 'CarJniDemo' may be using a version of Gradle that does not contain the method. <a href="open.wrapper.file">Open Gradle wrapper filea>
  • The build file may be missing a Gradle plugin. <a href="apply.gradle.plugin">Apply Gradle plugina>

将下面代码

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"

问题解决

你可能感兴趣的:(Android问题集锦)