Flavors or build types when apply plugin 'android-library' is used

2,530 views
Skip to first unread message

Mateusz Grzechociński

unread,
Aug 14, 2013, 11:10:29 AM8/14/13
to adt...@googlegroups.com
Hey,

I'm building a library using Gradle. Short question: does NBS support flavors/build types for library projects which have 'apply plugin 'android-library'?
I know how to use flavors in standard app project with 'apply plugin 'android', but with library project I get:

> Could not find method productFlavors() for arguments [build_3joit8nsg3q2ffgi781l8dsj2o$_run_closure4_closure13@6d34f3c8] on root project XYZ

Thanks in advance,
Mateusz

Xavier Ducrohet

unread,
Aug 14, 2013, 1:18:07 PM8/14/13
to adt...@googlegroups.com
Flavors are not supported by library project, though we want to add it at some point.

For build types we only have 2 build types (can't add any other). debug is the one used when running the tests of the library. release is the one that gets published for other projects to use or to artifact servers. We'll probably make this more like regular project when we add flavors.

No ETA at this time.


--
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!

Mateusz Grzechociński

unread,
Sep 12, 2013, 11:13:14 AM9/12/13
to adt...@googlegroups.com
Hey Xavier, any news in that area? I'm an co-author of a free library which is distributed in some variants (with different assets). I'd like to have a configuration, that when I run gradle script it would automatically prepare multiple *.aar files based on different variants. Do you have any hints how to achieve that with NBS but the missing support for flavors in library project?

Thanks in advance.
M.

Xavier Ducrohet

unread,
Sep 12, 2013, 2:13:38 PM9/12/13
to adt...@googlegroups.com
No update at this time.

Borys Boyko

unread,
Sep 30, 2013, 2:15:15 PM9/30/13
to adt...@googlegroups.com
Hello,

I am getthing this error when I try to include buildTypes under android in my build.gradle file:

"> Could not find method buildTypes() for arguments [build_25r1m0a3etn5cudtt5odlegprd$_run_closure2_closure10@46f0bf3d] on project"

This error occurs only if I apply plugin 'android-library'. I would like to use buildTypes to set runProguard to true for release mode.

What can I do?

Jake Wharton

unread,
Oct 1, 2013, 8:58:13 PM10/1/13
to adt...@googlegroups.com
Proguard should only be run at the tip (think: the APK). Your library can include proguard rules for use when it is actually run, though.

Crossle Song

unread,
Jan 6, 2014, 3:20:46 AM1/6/14
to adt...@googlegroups.com
Please support ndk prebuild library build...

David Fortunato

unread,
Jul 3, 2014, 6:26:55 AM7/3/14
to adt...@googlegroups.com
Any news about productFlavors/buildTypes on android-library? I really need this to generate some variants like this:

- Flavor1 -> URLdev1
- Flavor1 -> URLrelease1
- Flavor2 -> URLdev2
- Flavor2 -> URLrelease2

Valerio Santinelli

unread,
Jul 8, 2014, 5:36:15 AM7/8/14
to adt...@googlegroups.com
It looks like with Gradle Plugin 0.12 there's support for android-library modules but Android Studio 0.8.1 complains about different flavors and dependencies. Gradle itself actually builds the different flavors but with the wrong modules, so it's still useless in the current state. :(

Valerio
Reply all
Reply to author
Forward
0 new messages