Does Proguard remove unused code (on Android)

I was just wondering, I am designing a library to use with my Android projects. Now I am starting to include things like the apache FTP jar to support some debug file uploads.

I know that not all projects will use all parts of the library (e.g. some project will not have an FTP upload at all, but wants to use the UI tools from the library).

Now I got three questions:

  1. Does Proguard remove unsused sources (own code), like e.g. my UI tool classes, if they are never references from the main project – meaning not used in the application.

  2. Does Proguard remove external libraries (e.g. apache ftp jar) if never used. If not, I may include the source, if option 1 applies.

  3. How about resource files (not really Proguards job, more IntelliJ or Eclipse) – Example: I write a google map extension using default markers, stored in the library project. If I do not need the maps anyway, do the files get included in each android project – and is there an easy way to prevent that.

Some more backround: I try to keep all my library stuff in one project as long as possible. I don’t know a good point to split the library yet, so I don’t want to overkill to create seperate libs for everything (did that in the past, and most of the time it was way to much modularization)…

Thanks for any insights,
Chris

Answer

Does Proguard remove unsused sources

It tries to, when configured properly.

Does Proguard remove external libraries (e.g. apache ftp jar) if never used.

It tries to, when configured properly.

How about resource files (not really Proguards job, more IntelliJ or Eclipse) – Example: I write a google map extension using default markers, stored in the library project. If I do not need the maps anyway, do the files get included in each android project – and is there an easy way to prevent that.

No.

Leave a Reply

Your email address will not be published. Required fields are marked *