Angad Singh
Angad Singh

Reputation: 1061

Library Size and Method Counts

While developing an Android Library, if I add v7 Support Library as an dependency to use Toolbar class only, then would the final .aar file contain only the methods of Toolbar class and the related classes only, or it will contain that of Entire Support Library which wouldn't be in any use?

Upvotes: 1

Views: 999

Answers (2)

Divers
Divers

Reputation: 9569

It will be completely included in your aar. In order to do it in right you you should use provided, e.g.:

provided 'com.android.support:appcompat-v7:+'

In that case users of your library will use there own support library and will not have the same code of support library which will go with your lib.

Upvotes: 0

josemgu91
josemgu91

Reputation: 719

It'll contain the entire support library. In order to remove the unused classes and methods you should use ProGuard. Check out the official guide about code and resource shrinking.

Upvotes: 2

Related Questions