您的位置:首页 > 其它

Gradle DSL method not found: 'runProguard()'

2016-04-21 19:08 381 查看
from : /article/1376580.html

本来刚升级studio到1.0的时候就想写这篇文章的,但是没空就没写了。

好吧,今天把这个问题写下,因为很多同事也遇到这个问题,解决不了,在你把Android studio升级到1.0后,你会发现你的gradle sync的时候会报底下这个错:



报这个错的原因其实是因为你在升级完后,然后工程会默认把你的gradle版本替换成最新的版本,所以你的
build.gradle文件中的dependencies也变成最新的了,如下:
dependencies {

classpath'com.android.tools.build:gradle:1.0.0-rc1'

// NOTE:Do not place your application dependencies here; they belong

// in theindividual module build.gradle files

}
那为啥变成最新的就不行了,其实这个我觉得是gradle团队可能不是那么强大的原因吧,新版本可能没有做到向下兼容旧版本...其实看报错就知道了,runProguard()找不着了。以前也有出现过0.12到0.14后"useOldManifestMerger“找不到的问题。
要让sync成功,改下gradle的版本就可以了,如下:
dependencies {

classpath'com.android.tools.build:gradle:0.14.1'

// NOTE:Do not place your application dependencies here; they belong

// in theindividual module build.gradle files

}

PS,感谢ohskean的提醒,我这边也将他提供的方法加到文章来,
old:
buildTypes {
release {

runProguard false // 已经被废弃并且停止使用了

......
}
}
new:
buildTypes {
release {

minifyEnabled false // 替代的方式

......
}
}


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: