How to create JavaDoc using Android Studio without R and BuildConfig?

AndroidAndroid StudioJavadoc

Android Problem Overview


I want to generate the JavaDoc for my library excluding R and BuildConfig. The Generate JavaDoc... functionality from the Tools menu does not have the option to exclude files.

How to create JavaDoc using Android Studio without R and and BuildConfig?

Android Solutions


Solution 1 - Android

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:

  1. Open menu option Tools --> Javadoc.

  2. Select Custom scope. It's not necessary to select anything from the drop-down menu yet.

  3. Click the ... icon to open the Scopes dialog.

  4. Add a new custom scope with the green + icon. Give it a descriptive name if you wish.

  5. In Production Classes (not Library 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 exclude R.java and BuildConfig.java. When you're done, Click OK to exit the Scopes dialog.

  6. In the Specify Generate JavaDoc scope dialog, if your new scope is not selected in the Custom scope dropdown menu, select it now, as well as any other additional options including output directory.

  7. Finally, click OK to generate your Javadoc.

enter image description here

Solution 2 - Android

The accepted answer is quite complex and I have a better one.

  1. Open menu option Tools --> Javadoc.
  2. Select Custom scope. Then select Project Files
  3. Click OK.

enter image description here

After these you will see the R files and BuildConfig are excluded.

Solution 3 - Android

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:

  1. In the Project view on the left, select the root source directory to generate the docs for (e.g. "com" or "org")
  2. Open the JavaDoc generation dialog (Tools -> Generate JavaDoc...)
  3. Select "Custom scope" (it's the 5th radio button in my version) and select your module (e.g. "Module 'library'")
  4. 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.

Solution 4 - Android

Another way to do it is to 1- go Tools --> Generate JavaDoc... 2- select Custom scope 3- from the drop down menu select Open Files.

this method will generate documentation for only the opened files in ur window

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJan DeinhardView Question on Stackoverflow
Solution 1 - AndroidEric C. BlackView Answer on Stackoverflow
Solution 2 - AndroidguoView Answer on Stackoverflow
Solution 3 - AndroidRocketSpockView Answer on Stackoverflow
Solution 4 - AndroidAbdelsalam HamdiView Answer on Stackoverflow