`
http://blog.csdn.net/spinchao/article/details/52597041
今天studio升2.2 gradle也必須要生奠伪,從2.1變?yōu)?.2的時候, 配置在gradle的DefaultManifestParser來獲取版本號不能用用了谦纱, 修改 如下,? 原來的不能用的被注釋掉
//? ? ? ? def manifestParser = new? com.android.builder.core.DefaultManifestParser()
//? ? ? ? def versionName = 'v' + manifestParser.getVersionName(android.sourceSets.main.manifest.srcFile)
//? ? ? ? def versionCode = 'c' + manifestParser.getVersionCode(android.sourceSets.main.manifest.srcFile)
def? versionName='v'+ variant.getVersionName()
?def versionCode ='c'+variant.getVersionCode()