getOutputs之一调用它

getOutputs之一调用它

本文介绍了variant.getOutputFile()是pcated德$ P $。在variant.getOutputs之一调用它(),而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已经上来了,因为磕碰到摇篮2.1在Android的摇篮插件0.13.0,但对我的生活中,我不明白为什么日志这一警告的时候。

This has been coming up since the bump to gradle 2.1 in Android Gradle plugin 0.13.0, but for the life of me I can't understand why logs this warning sometimes.

考虑这一块基于变量类型重命名的APK:

Consider this block for renaming APKs based on variant type:

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def oldFile = output.outputFile
        if (oldFile != null && oldFile.name.endsWith('.apk')) {
            def newFile = "Fancy conditionally-formatted file name here"
            print "\nBefore"
            output.outputFile = new File(oldFile.parent, newFile)
            print "\nAfter"
        }
    }
}

综观摇篮日志,我看到这样的:

Looking at the gradle logs, I see this:

Before
WARNING [Project: <myproject>] variant.getOutputFile() is deprecated. Call it on one of variant.getOutputs() instead.
WARNING [Project: <myproject>] variant.getProcessResources() is deprecated. Call it on one of variant.getOutputs() instead.
After

他的似乎的建议,调用该行 output.outputFile =新的文件(oldFile.parent,NEWFILE)抛出这个警告。事情是,谷歌专门在<一个底部使用了这种风格在他们的榜样href="http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits#TOC-Variant-API-Version-$c$c-support"相对=nofollow>此页面。如果我们不能碰输出可言,我们如何能够将其 OUTPUTFILE

Which would seem to suggest that calling the line output.outputFile = new File(oldFile.parent, newFile) throws this warning. Thing is, Google specifically uses this style in their example at the bottom of this page. If we can't touch output at all, how can we set its outputFile?

在此之上,我看不出 getProcessResources()参与。

On top of this, I don't see how getProcessResources() is involved.

任何想法?

推荐答案

原来的摇篮插件仍然使用去precated引擎盖下调用。由于Android的摇篮插件0.14.4,这些警告不再出现。

It turned out that the Gradle plugin was still using deprecated calls under the hood. As of Android Gradle Plugin 0.14.4, these warnings no longer appear.

这篇关于variant.getOutputFile()是pcated德$ P $。在variant.getOutputs之一调用它(),而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:42