Proguard instructions inside aar package.

2,157 views
Skip to first unread message

Roman Mazur

unread,
Oct 11, 2013, 2:59:10 PM10/11/13
to adt...@googlegroups.com
Earlier proguard.txt file located in the root of a library project was included to aar package. 
But after some plugin update I do not see it in any more (my aar misses proguard.txt). As a result appropriates proguard rules are not applied when application is built.
And I cannot found any documentation covering this question...
I do not seem to change library build and blame plugin update only, but maybe I'm mistaking...?

Xavier Ducrohet

unread,
Dec 6, 2013, 6:28:03 PM12/6/13
to adt...@googlegroups.com
This is because we can now apply proguard to the library code (to obfuscate internals for instance). So the DSL that was common to app and library plugin but had a different effect is now doing the same thing : configuring the project when running Proguard.

However there is a new DSL to configure which proguard rule file to package inside the aar:

android {
   defaultConfig {
        consumerProguardFiles 'rules1.txt', 'rules2.txt'
   }
}

(you can also add files through the debug or release type in case you want to.)



--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Roman Mazur

unread,
Dec 7, 2013, 1:03:04 AM12/7/13
to adt...@googlegroups.com

Thanks for explanations.

You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/BUIV_FDpq28/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

James Wald

unread,
Sep 13, 2014, 2:27:11 AM9/13/14
to adt...@googlegroups.com
I recently switched to consumerProguardFiles and experienced an issue with clean builds. The ProGuard rules are not being merged into the application's ProGuard configuration. Subsequent builds do have all of the ProGuard rules as expected.

Apparently this is a known issue http://b.android.com/69625. Is anyone aware of a tenable workaround for this issue besides doing two builds?

Xavier Ducrohet

unread,
Sep 16, 2014, 2:33:52 PM9/16/14
to adt...@googlegroups.com
This was https://code.google.com/p/android/issues/detail?id=69625 and this has been fixed for the next release.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages