AndroidStudio遇到Gradle sync failed: Plugin with id 'com.android.application' not found.

AndroidStudio导入例程时遇到Gradle sync failed: Plugin with id 'com.android.application' not found.这个问题。


我参照了一些资料通过添加一段代码到外build.gradle文件成功运行具体方法如下


1、打开一个你能运行的工程,找到他的外build.gradle文件


打开找到代码:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
复制或者替换 添加到例程的外build.gradle文件中.
再clean一下程序就能正常运行了。

clean过后可能遇到

buildToolsVersion 错误的问题 需要连接网络下载,
这个问题可以通过修改内build.gradle文件使其版本与你能运行的例程一致即可
如果没有能运行的例程直接新建一个hello world就好 最简单的办法!
希望可以帮到大家

猜你喜欢

转载自blog.csdn.net/u012465304/article/details/54908471