Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any disadvantages in adding too many libraries in Android?

I've been wanting to add a lot of Android libraries to my project using Gradle.

If lets say 10 libraries were added, will it have negative side effects?

Like will it expand the app's size, eat more memory, or slow down the app?

like image 524
zeroh729 Avatar asked Sep 29 '22 08:09

zeroh729


1 Answers

I think the disadvantages is not a too large APK, or the possible method limit of 65536 without using multidex (https://developer.android.com/studio/build/multidex.html).

You can avoid this by using Proguard (https://developer.android.com/studio/build/shrink-code.html), this will drastically decrease the number of methods, because you will almost never use all parts of your libraries.

The real disadvantage in my opinion (I was involved in many different projects where libraries where used for almost everything you can imagine) is the maintainability. Some libraries increase the complexity and reduce debuggability if not used correctly, or if you don't really think about the correct usage.

So when you want to use a library, use it, but think about the following:

  • Is it really intended to be used for my purpose? (read the doc)
  • How do I correctly use it? (read the doc)
  • Do I really need it, or can it be implemented with standard frameworks? (Don't reinvent the wheel, but probably the library is overdone for your purpose)

Hope this helps a little bit

regards Lukas

like image 71
drlue Avatar answered Oct 05 '22 07:10

drlue