Create Android library AAR including javadoc and sources

守給你的承諾、 提交于 2019-11-30 04:25:20

Seems like it can't be done for now. However, adding these gradle tasks in the deploy.gradle, the -javadoc.jar and -sources.jar are created.

task androidJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
}

task androidJavadocsJar(type: Jar) {
    classifier = 'javadoc'
    baseName = artifact_id
    from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
    classifier = 'sources'
    baseName = artifact_id
    from android.sourceSets.main.java.srcDirs
}

artifacts {
//    archives packageReleaseJar
    archives androidSourcesJar
    archives androidJavadocsJar
}

After that, the sources and javadoc need to be manually imported. According to this thread and this open issue they can't be automatically imported.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!