TaskInputs.files: NoSuchMethodError

I have a task method defined, taking some type and using the files method as source to from. While this is working with Gradle 4.6, it results into TaskInputs.files: NoSuchMethodError. I cannot figure out why. Any tips?

Hi Carlo,

could you maybe provide the full code example? There is a TaskInputs.files method in Gradle 5.0 (I guess that is the version when it fails), but a bridge method has been removed. Maybe that is causing the problems you are seeing.

Cheers,
Stefan

The code is not mine, but from an open source project. Here it is:

task svgToPng(type: fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask) {
    from = files('graphics')
    to = file('res')
    targetedDensities = ['hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']
    outputFormat = 'PNG'
    outputType = 'mipmap'
}

It works with Gradle 4.6 (which is the projects version), but not with 5.0 or 5.1. I’m just curious, why not.

@Stefan_Wolf: can you reproduce the problem? And how could or should this be fixed?

If you can provide me with a link to the open source project and some steps how to reproduce it I may have a better idea what is going on. Currently, I don’t know why files would use TaskInputs.files and not Project.files.

It’s the - in Germany - famous ‘Oeffi’ project; the gradle build is at https://gitlab.com/oeffi/oeffi/blob/master/oeffi/build.gradle.

Thanks, I found the problem. The actual call is in the task class: https://github.com/avianey/androidsvgdrawable-plugin/blob/master/plugin/gradle/src/main/java/fr/avianey/androidsvgdrawable/gradle/SvgDrawableTask.java#L72

This class is compiled against Gradle 2.2.1 where this method still returns TaskInputs. We kept the old method as a bridge method until it was removed in Gradle 5.0. The new methods seem to be there since Gradle 3.0.

So the plugin would need to be recompiled against Gradle 3.0 to work with Gradle 5.x.

Cheers,
Stefan

Thanks Stefan for your investigation!