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.
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
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
?
On top of this, I don't see how getProcessResources()
is involved.
Any ideas?