您的位置:首页 > 移动开发

Could not findproperty 'packageApplication'

2015-04-14 11:10 381 查看
由于gradle 升级导致兼容问题解决方法

Error:Could not findproperty 'packageApplication' oncom.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@5fc07ff0.
Couldnot find property 'zipAlign' on com.android.build.gradle

(1)
def apk =
variant.packageApplication.outputFile;

def newName = "";

修改为:

def apk = variant.outputs[0].outputFile;

def newName = "";

(2)
variant.packageApplication.outputFile = new File(apk.parentFile, newName);

if (variant.zipAlign) {

newName = newName.replace("-unaligned", "")

log.info "$newName"

variant.zipAlign.outputFile = new File(apk.parentFile, newName);

}

修改为:
variant.outputs[0].outputFile= new File(apk.parentFile, newName);

if (variant.outputs[0].zipAlign) {

newName = newName.replace("-unaligned", "")

log.info "$newName"

variant.outputs[0].zipAlign.outputFile= new File(apk.parentFile, newName);

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