简体   繁体   English

Android Studio Aar使用Javadoc混淆了库发布

[英]Android Studio aar obfuscated library publishing with javadoc

I have published Android libraries in a private Artifactory like so . 我已经像这样在私人Artifactory中发布了Android库。 Javadoc is generated and published as a jar file together with the aar library to artifactory. 生成Javadoc并将其作为jar文件与aar库一起发布到工件。

However, when using the library from another Android Studio project, the javadoc is not automatically showing in Android Studio quick documentation. 但是,当使用另一个Android Studio项目中的库时,javadoc不会自动显示在Android Studio快速文档中。
Upon a little more trial and errors, it seems that javadoc will be shown in the quick documentation of Android Studio if the library is not obfuscated during publishing 经过更多的试验和错误,如果发布时混淆库,似乎Javadoc将显示在Android Studio的快速文档中

How can I go about publishing my obfuscated library and show javadoc without additional configuration in Android Studio for library users? 如何在Android Studio中为库用户发布混淆的库并显示javadoc,而无需进行其他配置?

[Edit] [编辑]
The published library files are: 已发布的库文件为:
aar, javadoc.jar, sources.jar, pom file aar,javadoc.jar,sources.jar,pom文件

Currently, the sources.jar allows developers to reverse engineer the un-obfuscated source code, but still does not provide the javadoc for the library. 当前,sources.jar允许开发人员对未混淆的源代码进行反向工程,但仍不提供该库的javadoc。

You need to do 'sources' release as well. 您还需要进行“源代码”发布。 If i understand you correctly, you want the developer which uses your aar to be able to see the documentation of the class with your notes. 如果我正确理解您的要求,那么您希望使用aar的开发人员能够看到带有注释的课程文档。

In your gradle file, create a 'source' job like so : 在gradle文件中,创建一个“源”作业,如下所示:

task javadocTask(type: Jar) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

task sourcesTask(type: Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource 
    //Or exact project path if you don't have sourceSets : from "YOUR_PROJECT/src/main/java"
}

artifacts {
    archives sourcesTask
    archives javadocTask
}

First of all, you need to ensure that you are not obfuscating public APIs of your library. 首先,您需要确保不会混淆库的公共API。

By default the javadoc for a library is not downloaded until specified explicitly. 默认情况下,除非明确指定,否则不会下载库的javadoc。 You need to put following config in application's main build.gradle 您需要将以下配置放在应用程序的主build.gradle中

idea {
  module {
    downloadJavadoc = true
   }
}

Sync project with gradle file by clicking on Sync Now link from top right or by clicking following icon: Sync Project with gradle file 通过单击右上角的立即同步链接或单击以下图标,将项目与gradle文件同步 :将项目与gradle文件同步

Android studio will download the javadoc and link it with your API appropriately. Android studio将下载javadoc并将其正确链接到您的API。

If the javadoc is still not visible then try to invalidate cache and restart android studio from: File > Invalidate Caches/ Restart > Invalidate and Restart. 如果javadoc仍然不可见,请尝试使缓存无效并从以下位置重新启动android studio:文件>无效缓存/重新启动>无效并重新启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建包含 javadoc 和源代码的 Android 库 AAR - Create Android library AAR including javadoc and sources 将Android库(aar)发布到Bintray,并选择其他风味 - Publishing Android Library (aar) to Bintray with chosen flavors 在Android Studio中创建AAR库 - Creating a AAR Library in Android Studio 在Android-Studio中将本地javadoc添加到本地aar - Add local javadoc to local aar in Android-Studio Android Studio:另一个AAR库中的AAR库依赖项 - Android Studio : AAR Library dependency inside another AAR Library Android AAR 取决于 AAR 失败并生成 javadoc - Android AAR depending on AAR fails with javadoc generation 在Android Studio 2.2中创建库和AAR - Create Library and AAR in Android Studio 2.2 将C ++ AAR库添加到Android Studio中? - Adding a C++ AAR library into Android Studio? Android - 当 minifyEnabled true 导致 java.lang.ExceptionInInitializerError 时,带有混淆 AAR 库的应用程序崩溃 - Android - App with obfuscated AAR library is crashing when minifyEnabled true causes java.lang.ExceptionInInitializerError android studio 3.1中混淆的android库jar文件位置 - Obfuscated android library jar file location in android studio 3.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM