Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does adding same library dependency to different Android gradle modules increase APK size?

If I have multiple modules in my android project and I add a library dependency (like dagger or appcompat) in (say) 2 of those modules, will that library add twice of its size to the final APK size or will there be just one copy of the library in the final APK?

Also what if I use different versions of the library in different modules, how much will the APK size increase?

like image 444
Arpit Shukla Avatar asked Aug 07 '26 08:08

Arpit Shukla


1 Answers

I have the same question which you asked so I tested this scenario and create a project with more then one module and place the pdf dependency implementation 'com.github.barteksc:android-pdf-viewer:2.8.2' in different module and then build the apk but there is no change in size of apk either to put dependency in one module or more then one module.

like image 131
Umer Bilal Avatar answered Aug 09 '26 21:08

Umer Bilal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!