Error:(1, 0) Plugin with id 'com.android.application' not found

从github上下载了一个工程,导入Android studio的时候就报了Error:(1, 0) Plugin with id 'com.android.application' not found这个错。

Error:(1, 0) Plugin with id 'com.android.application' not found

在*这个网站上找到了解决的方法。如下方截图所示。

网址:https://*.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found

Error:(1, 0) Plugin with id 'com.android.application' not found

我的这个报错的工程比较奇怪,里面只有一个build.gradle。

于是我就在这个build.gradle中添加上方截图的代码。

Error:(1, 0) Plugin with id 'com.android.application' not found


[html] view plain copy
  1. buildscript{  
  2.     repositories{  
  3.         jcenter()  
  4.     }  
  5.   
  6.     dependencies{  
  7.         classpath "com.android.tools.build:gradle:2.3.3"  
  8.     }  
  9. }  

添加的代码就在红框里。


但是点击一下gradle按钮后,又出现了其他的错误。


Error:(1, 0) Plugin with id 'com.android.application' not found


于是又百度了一下Failed to resolve: junit:junit:4.12。

又在*上找到了答案。网址如下:https://*.com/questions/32519219/error23-17-failed-to-resolve-junitjunit4-12

Error:(1, 0) Plugin with id 'com.android.application' not found


我添加的位置如下:


Error:(1, 0) Plugin with id 'com.android.application' not found


上面截图中红框的代码如下:

[html] view plain copy
  1. repositories {  
  2.        maven { url 'http://repo1.maven.org/maven2' }  
  3.    }  


再gradle一下,bug就没了。就是这么简单。