Javadoc including a list of files doesn't work

http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html#org.gradle.api.tasks.javadoc.Javadoc:include(groovy.lang.Closure)

Here is what I’m doing:

task androidJavadocs(type: Javadoc) {

failOnError = false

classpath += project.files(android.plugin.getBootClasspath().join(File.pathSeparator))

println "Javadoc classpath: " + classpath.asPath

FileCollection publicSource = files(‘src/com/example/Class1.java’,

‘src/com/example/Class2.java’)

include(copySpec {

from ‘source’

into ‘destination’

include { it.file in publicSource }

})

println "Javadoc sources: " + source.asPath

}

What is wrong with this?

There is no ‘include’ method that takes a ‘CopySpec’. (Where did you get this from?) Have you tried ‘include “com/example/Class1.java”; include …’? Additionally, you’ll need to set ‘source’ (typically to some source set).

PS: Please always include the full error message.