Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle build Javadoc task fails with 'unknown tag: attr'

I am attempting to build the android-autofittextview project from the command line using gradle. However, it fails every time with the following error:

/Users/me/android-autofittextview/library/src/main/java/me/grantland/widget/AutofitHelper.java:384: error: unknown tag: attr
     * @attr ref android.R.styleable#TextView_textSize

This error is repeated a dozen times in various files.

This happens during the :library:androidJavadocs

I tried turning it off using this approach, but then I get an 'unknown tasks' exception when I attempt to us this as a library project later on.

How can I get javadocs to build correctly with Gradle when the @attr flag is being used?

like image 954
esilver Avatar asked Oct 20 '15 20:10

esilver


People also ask

What is dependsOn in gradle?

dependsOn(jar) means that if you run assemble , then the jar task must be executed before. the task transitive dependencies, in which case we're not talking about tasks, but "publications". For example, when you need to compile project A , you need on classpath project B , which implies running some tasks of B .

What is gradle task type?

Gradle supports two types of task. One such type is the simple task, where you define the task with an action closure. We have seen these in Build Script Basics. For this type of task, the action closure determines the behaviour of the task. This type of task is good for implementing one-off tasks in your build script.

Where gradle tasks are defined?

C:\> gradle –q taskY. Output. The output is given herewith − taskX taskY. The above example is adding dependency on task by using its names. There is another way to achieve task dependency which is, to define the dependency using a Task object.


1 Answers

A javadoc tool has an argument to specify custom tags. That parameter is -tag.

To pass that argument from gradle build file to javadoc tool add a configuration to your build.gradle as follows:

javadoc {
    options.tags = [ "attr" ] 
}

Custom tags can be specified as single argument with <name>:<placement>:<head>:

javadoc {
    options.tags = [ "attr:a:head" ] 
}
like image 148
m-szalik Avatar answered Oct 20 '22 17:10

m-szalik