Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl

Android studio从1.0 RC 4升级到1.0(其实就是打了一个8M的patch)后,这个时候相应的gradle的版本也会直接使用“com.android.tools.build:gradle:1.0.0”,如果这时你在gradle文件中又用到outputFile就会出现上述的问题。好吧,其实这也是gradle团队搞的问题,有时候我们多希望gradle能像android一样,对旧版本有一个非常好的兼容性。

废话不多说,直接说怎么解决这个问题吧,这个问题的原因是outputFile这个函数被换地方了。

old:

applicationVariants.all { variant ->
            ......
            variant.outputFile = new File(variant.outputFile.parent, name);
	    ......
            }

}

 
 

 
 

new:    

applicationVariants.all { variant ->
            ......
            variant.outputs.each { output ->
                output.outputFile = new File(output.outputFile.parent, name);
	    ......
            }

}

 
 

 
 

按上述方式改就ok了。

猜你喜欢

转载自blog.csdn.net/hyr83960944/article/details/41842327
今日推荐