我曾经在build.gradle
中使用以下Gradle任务为我的Android应用构建Javadoc:
task javadoc(type: Javadoc) {
title = "My Docs v${android.defaultConfig.versionName}"
failOnError false
options.memberLevel = JavadocMemberLevel.PUBLIC
source = android.sourceSets.main.java.srcDirs
destinationDir = file("${project.rootDir}/docs/")
classpath += android.sourceSets.main.compileClasspath + android.sourceSets.main.output
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
// packages to exclude from the docs
exclude "com/example/README*"
// workaround for https://github.com/gradle/gradle/issues/19726 when using "exclude"/"include"
options.addStringOption("-source-path", android.sourceSets.main.java.srcDirs.join(":"))
}
字符串
然而,从Gradle 7和JDK 1.6升级到Gradle 8和JDK 17后,这不再起作用。我得到这个错误:
Execution failed for task ':example:javadoc'.
> path may not be null or empty string. path=''
型
当我用android.getBootClasspath()
取消注解该行时,我得到其他错误,如:
…/Example.java:21: error: package android.util does not exist
import android.util.Log;
型
看看相关的问题,这些都不适用,或者那里的修复不起作用:
- Cause: path may not be null or empty string. path=''
- A problem occurred evaluating project ':app'. > path may not be null or empty string. path='null'的
- Cannot build my android studio project on another PC, gradle says "Cause: path may not be null or empty string. path='null'"的
- ERROR: path may not be null or empty string. path='null'的
- Android proguard issue: path may not be null or empty string. path='null'的
- https://github.com/expo/expo/issues/22584
我该怎么办?
1条答案
按热度按时间jhiyze9q1#
解决方案似乎是删除这些行:
字符串
相反,添加以下内容:
型
这似乎解决了JDK 17的问题。
https://github.com/emanuele-f提供此解决方案的秘诀。