Is there a Difference in APK size between Gradle and local AAR dependencies?

Viewed 241

Is there any difference in the size of the resulting Android APK file between:

  • Adding a dependency via a local AAR file (e.g., via File > New Module > Import .JAR or .AAR package)
  • Adding a dependency via a Gradle dependency (e.g., implementation "com.foo.bar:bar:1.2.3") that points to same AAR file

If there is a difference, what could be the cause of that difference?

1 Answers

No, it doesn't matter where the AAR is sourced from. The size should be equivalent in both cases. Gradle simply provides an easy method to include the AAR without having to put it and all its dependencies in your repository.

One situation in which it might differ is if the Gradle dependency has additional dependencies that aren't strictly necessary. In that case, those dependencies would also be included, increasing the size of your APK. That would be a misconfiguration on the part of the dependency author, though, and something they should fix. In general, this shouldn't happen.

Related