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

妖精的绣舞 提交于 2019-12-05 16:57:31

问题


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?


回答1:


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" ] 
}


来源:https://stackoverflow.com/questions/33246400/gradle-build-javadoc-task-fails-with-unknown-tag-attr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!