Excluding package from javadoc task throws error

Im trying to exclude a specific package from the javadoc, but when i try to run the build from the cli
./gradlew :moduleName:BuildNameVariantNameDocs i will get errors about the package i excluded was not found.

while executing the task from the IDE (Android Studio) i always get an output (errors become only warning) but if i try to generate the javadoc via cli i even get errors when setting failOnError false.

here is the javadoc task construction from app/build.gradle:

android.libraryVariants.all { variant ->
        def task = project.tasks.create("${variant.name}Docs", Javadoc) {
        group "ApiDoc"
        title = 'Test123 ' + android.defaultConfig.versionName
        options.addStringOption('Xdoclint:none', '-quiet')
        options.windowTitle = 'Test123'
        options.memberLevel = JavadocMemberLevel.PUBLIC
        options.linkSource false
        options.author = false

        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))

        exclude "**/R"
        exclude "**/R.**"
        exclude "**/R\$**"
        exclude "**/BuildConfig*"
        exclude '**/*.kt'

        // add dependency libraries to classpath
        afterEvaluate {
            classpath += files(variant.javaCompileProvider.get().classpath.files)
            // FIXME: package not found
            exclude 'com/company/product/helper/**'
        }
    }

    // make sure that we only generate the documentation if we've built the library
    task.dependsOn "assemble${variant.name.capitalize()}"
}

Some help would be appreciated!