Search code examples
androidapk

Are external dependency's original sources get packed into the final apk if provided as a separate maven artifact?


Suppose my Android app uses an external dependency (some aar), e.g.:

dependencies {
    implementation "some.lib:1.2.3"
}

The dep's aar itself has no sources packed into it, just bytecode. But there is also a separate aar file that contains only original source code in plain text and it is published along with the "main" aar at maven repo. In Android Studio, if I click a class represented by that lib I can see the original source code (vs decompilation). Nice.

Now the question: do the original source code gets packed into the final apk of my app? This is specifically for the case - when a dependency provides original sources as a separate maven artifact in addition to the main aar/jar contaning only byte code .


Solution

  • To my knowledge Maven source artifacts are optional and only for use within the development IDE so you don't have to decompile the byte code and also have the source code comments available including JavaDoc.

    When you compile your app the source code AAR/JAR dependencies are simply ignored - the compiler only uses the artifact containing the byte code.