It is not always a choice. All my libraries are written in Java and I couldn't make B4A classes doing the same. Moreover, I'm not sure there's a real benefit in tracking and cleaning the unused functions (if not done automatically) because 99% of libraries for B4A have a size under 1MB, and a lot of them are even under 200 KB. Sparing 100 KB in the best case is not worth the time spent.
The only case that really bothers me is the Phone library. It does a lot of different things (too much to my taste) and, when you just want to know the version of Android or set a wake lock, for example, you get in your APK all the code to send and receive SMS, and I don't like when security apps report that my app can send SMS for this stupid reason. So I created many small libraries to call the same functions.