How to generate links to the android Classes' reference in javadoc?

前端 未结 7 1199
渐次进展
渐次进展 2020-12-13 06:58

When I generate javadoc for my Android project in Eclipse, there are lots of warnings like

cannot find symbol
symbol  : class TextView

and

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 07:09

    For those of us daring enough to have switched over to the ever-evolving Android Studio & Gradle, one of the things that actually works and makes things a little easier is referring to a package-list location either locally or on the web. For example, the following code from Julian generates javadoc files:

    task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
        title = "Documentation for Android $android.defaultConfig.versionName b$android.defaultConfig.versionCode"
        destinationDir = new File("${project.getProjectDir()}/doc/compiled/", variant.baseName)
        source = variant.javaCompile.source
        ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
        classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
    
        description "Generates Javadoc for $variant.name."
    
        options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PRIVATE
        options.links("http://docs.oracle.com/javase/7/docs/api/");
        options.links("http://developer.android.com/reference/reference/");
        exclude '**/BuildConfig.java'
        exclude '**/R.java'
    }
    

    But this resulted in a warning during the build because the package-list isn't available anymore (if it ever was) at

    options.links("http://developer.android.com/reference/reference/");
    

    At first I thought maybe the redundant reference/reference was the issue, but the package-list was also unavailable at

    options.links("http://developer.android.com/reference/");
    

    So, after reading the discussion on this thread, that one line can be changed to refer to the local reference directory within the SDK:

    options.links("c:\\path-to-sdk-directory\\docs\\reference");
    

    It finds the package-list locally and doesn't display the warning message anymore.

提交回复
热议问题