0

he was using butterknife to bind controls? I need to know will removing butterknife result in a reduced size to the apk

as i need to shrink the apk.

Also if possible please mention the pro and cons of using it .

Samar
  • 21
  • 1
  • 5

2 Answers2

0

ButterKnife has an official web page here http://jakewharton.github.io/butterknife/. It has a very small size, so you don't shrink the apk size much by removing this dependency.

ButterKnife uses code generation to bind annotated views - it means no hurt to app perfomance from reflection of similar. Also annotations provide very clear and pretty looked code. So I strongly recommend to use this tool.

I have noticed only one disadvantage in this lib - there is no annotations for some view listeners, so you are being forced to mix ButterKnife style with usual Android one.

You can determine approximate dependecy size by number of methods it contains. You can use this online tool http://inloop.github.io/apk-method-count/.

Yev Kanivets
  • 1,780
  • 3
  • 22
  • 38
  • Hello @evegenii , thanks for the quick response . Also can you tell me is there a way to know the size of a library included in a project as the project i am working on contains around 25 other libraries. – Samar Apr 27 '16 at 08:57
  • @Samar added a link to an answer. – Yev Kanivets Apr 27 '16 at 09:01
  • @evegenii thanks but i tried that link and its a bit ambiguous attaching a link to the screenshot. http://postimg.org/image/4371j0hq9/ can you please elaborate – Samar Apr 27 '16 at 09:07
  • @Samar you need to look for packages of your dependencies and estimate how much methods are in that packages. Also you can try to use ProGuard - if configured right it removes methods that you don't use. Also try to run 'Code inspection' in Android Studio - it may be some of drawables you added to project are not used anymore. – Yev Kanivets Apr 27 '16 at 09:13
0

ButterKnife let's you not write boilerplate code, but as this code is still needed in your app, ButterKnife will generate it for you. Sure, the library will add some bytes to the resulting APK but I'd not bother really as the overhead will be quite small. If you want to measure more precisely, just write the sample app with and without it and compare. But I'd not waste my time for that really ad stick to the ButterKnife to keep my sources cleaner.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141