gradle – How to generate JavaDoc for android application?-ThrowExceptions

Exception or error:

I am trying to generate javadoc for android application using a command or a gradle task.
I tried this command:

javadoc -protected -splitindex  -bootclasspath /Users/[username]/Library/Android/sdk/platforms/android-29/android.jar -Xdoclint:none -sourcepath app/src/main/java -subpackages .

And the result was:

error: package androidx.appcompat.app does not exist
import androidx.appcompat.app.AppCompatActivity;

Also I’ve tried tasks like this :

task createJavadocs (type: Javadoc) {
    source = project.android.sourceSets.main.java.srcDirs
    options.linkSource true
    classpath += project.files(project.android.getBootClasspath().join(File.pathSeparator))
    failOnError false  
}

Which gives the same output.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *