从GitHub上down的一个项目,导入自己的Android studio (3.0)显示报错:
Error:(1, 0) The android gradle plugin version 3.0.0-alpha1 is too old, please update to the latest version.
To override this check from the command line please set the ANDROID_DAILY_OVERRIDE environment variable to
"85d245b6eb7e679c808bbbe7f412b0905b7e5b6a"
<a href="fixGradleElements">Upgrade plugin to version 3.0.0-alpha1 and sync project</a><br><a
href="openFile:C:/Users/mipwwpoint/Desktop/TestZxing/TestZxing/build.gradle">Open File</a>
插件的版本过时了,因为alpha1的使用期限只有40天,相当于就是个过渡测试版本。
解决办法:
项目最外层的build.gradle 中:
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' //改下gradle的版本号,从github上down下来时是4.0,我改成了2.3.2版本// NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}
改完之后 studio 会联网下载好多东西(我的是这样....)
不改这里的话通过图形界面修改也一样:
点击出现:
down下来默认是gradle version 是4.0 ,plugin version 是3.0.0-alpha1。我修改成如图所示。
附带gradle version 与plugin version之间的版本关系: