How to create JavaDoc using Android Studio without R and BuildConfig?
If you want to exclude the generated files (R, BuildConfig, etc.) then you can specify a custom scope for the JavaDoc generation. For this to correctly work you will need to:
- In the Project view on the left, select the root source directory to generate the docs for (e.g. "com" or "org")
- Open the JavaDoc generation dialog (Tools -> Generate JavaDoc...)
- Select "Custom scope" (it's the 5th radio button in my version) and select your module (e.g. "Module 'library'")
- Select your other properties such as output directory, method visibility, etc. and click "OK"
That's it. Your JavaDocs should be generated without the R or BuildConfig files included.
The accepted answer is quite complex and I have a better one.
- Open menu option Tools --> Javadoc.
- Select Custom scope. Then select
Project Files
- Click
OK
.
After these you will see the R files and BuildConfig are excluded.
RocketSpock's answer is almost there, but not quite (as of this writing). I can't comment yet, so I'll describe the process I used to exclude R.java
and BuildConfig.java
from my Android library's Javadoc in Android Studio 1.2.2. There's basically an extra dialog that will come in very handy:
Open menu option
Tools --> Javadoc
.Select
Custom scope
. It's not necessary to select anything from the drop-down menu yet.- Click the
...
icon to open theScopes
dialog. - Add a new custom scope with the green
+
icon. Give it a descriptive name if you wish. - In
Production Classes
(notLibrary Classes
, since those are imports) navigate to the module(s) you wish to generate Javadoc for, and select any individual Java files you wish to include. In your case, you probably want to select an entire module but manually excludeR.java
andBuildConfig.java
. When you're done, ClickOK
to exit the Scopes dialog. - In the
Specify Generate JavaDoc scope
dialog, if your new scope is not selected in theCustom scope
dropdown menu, select it now, as well as any other additional options including output directory. - Finally, click
OK
to generate your Javadoc.