Sunday, 18 December 2022

Published sources in maven local repository not visible in Android Studio IDE if proguard (R8) minification turned on

I want to publish some sources so that consumers of our closed source library can see documentation in their IDEs. I have this working so far:

task androidSourcesJar(type: Jar) {
    archiveClassifier.set('sources')
    include(listOfPublicApiFiles)
    includeEmptyDirs = false
    from android.sourceSets.main.java.srcDirs
}

publishing {
    publications {
        standardRelease(MavenPublication) {
            afterEvaluate {
                from components.standardRelease
                artifact androidSourcesJar
            }
            groupId = 'com.company'
            artifactId = "myartifact"
        }
    }
}

This works perfectly if minifyEnabled false is set, but as soon as I set minifyEnabled true, then no documentation at all appears in the IDE (by pressing F1 etc). Is this an IDE bug? The sources.jar is still there, and appears to be linked properly. I don't see why it shouldn't work? I've tried making sure that these public api files are not minified at all by setting keep in proguard-rules, but it doesn't help, documentation in IDE is blank.

I'm using Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 30, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 aarch64

but I have also tried on Electric Eel and Dolphin Android Studio.



from Published sources in maven local repository not visible in Android Studio IDE if proguard (R8) minification turned on

No comments:

Post a Comment