Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is proguard.cfg needed for library projects?

Assuming I need to apply the same rules for both an application project and a library project on which it relies, do I need to duplicate the content of proguard.cfg from the application to the library project?

In other words, does the application's proguard.cfg "take over" all the library projects on which it depends, or must I explicitly specify rules for each of the library projects?

like image 780
Regex Rookie Avatar asked Jun 11 '12 14:06

Regex Rookie


People also ask

What is ProGuard CFG?

Xamarin. Android ProGuard is a Java class file shrinker, optimizer, and pre-verifier. It detects and removes unused code, analyzes and optimizes bytecode. This guide explains how ProGuard works, how to enable it in your project, and how to configure it.

What is a ProGuard file?

ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size of your Android application as well as removing unused classes and methods that contribute towards the intrinsic 64k method limit of Android applications.


2 Answers

Library projects by themselves don't run ProGuard, so they don't use any configuration.

Application projects obfuscate the entire code base, including any referenced libraries, so they need proper configuration for the application code and for the library code.

like image 51
Eric Lafortune Avatar answered Sep 20 '22 18:09

Eric Lafortune


It appears that the answer is "No": Proguard will obfuscate code from the libraries too.

But that was in 2010 and we know very well that specifications keep changing, especially in the Android development tools. So if a more authoritative answer comes along, I will accept it.

like image 32
Regex Rookie Avatar answered Sep 20 '22 18:09

Regex Rookie