简体   繁体   中英

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

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

  • Adding a dependency via a local AAR file (eg, via File > New Module > Import.JAR or.AAR package)
  • Adding a dependency via a Gradle dependency (eg, 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM