How to keep javadoc visible after obfuscating

后端 未结 2 1473
耶瑟儿~
耶瑟儿~ 2020-12-21 23:23

I built a nice Javadoc documentation for my project which is a JAR file for developers.

But after I run proguard in order to obfuscat my code all th

相关标签:
2条回答
  • 2020-12-21 23:45

    From the Proguard's page:

    ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode. Having ProGuard run is completely optional, but highly recommended.

    So I am not sure why are you running Proguard. Just configure it in your project and leave the build system to obfuscate upon release build. Your source code remains untouched this way.

    0 讨论(0)
  • 2020-12-22 00:02

    Javadoc is extracted from source files. It is not possible to create javadoc from class files, neither clean nor obfuscated. ProGuard operates on the class files created from compiling your source files, and produces obfuscated class files from it. This is completely unrelated to javadoc creation.

    The output of the Javadoc processor usually goes to a directory structure. Of course, you can zip that and give it the .jar extension to provide the javadoc as well. I’ve seen it often (i.e, on Apache Commons) to name your library JAR some foo-bar-1.2.3.jar and the zipped javadoc foo-bar-1.2.3-javadoc.jar.

    It is a good idea to provide the javadoc separated from the binary, as the binary needs to be included in a program distribution that relies on it, whereas the javadoc is only interesting for the developer and would only increase the size of the program without any need if it was in the same JAR.

    In the IDE, you need to assign the javadoc JAR to the library JAR. In Eclipse, this can be done from the PropertiesJava Build Path dialogue. After having added the JAR file, expand the white arrow next to the entry you created, select Javadoc location and then Edit…. Eclipse understands reading Javadoc from archive directly and you don’t need to unzip it.

    0 讨论(0)
提交回复
热议问题