重装系统时,重新安装AS和导入项目出现的问题。
Error:(19, 0) Gradle DSL method not found: 'google()' Possible causes:<ul><li>The project 'trunk' 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 'trunk' may be using a version of Gradle that does not contain the method. <a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin. <a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
原报错的gradle内容;
buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin // classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' } } }
把两行google()注释掉后重新编译就没问题了