Build variants in Gradle for a Library Project in Android

It’s a @bifmadei answer from google code issue and it helps for me: Obsolete 1: Try setting this in the dependency project android { publishNonDefault true … } Obsolete 2: Starting from gradle 4.10.1 publishNonDefault is true by default. So just use the recommendation below: Include this in the project that uses it dependencies { … Read more

Gradle: add dependency for a specific flavour of the library

In your library you need to tell gradle to build every time every variant: android { publishNonDefault true } Then in your application, since recently I guess, you can do this: dependencies { (…) devCompile project(path: ‘:lib’, configuration: ‘devDebug’) // or ‘devRelease’ storeCompile project(path: ‘:lib’, configuration: ‘storeRelease’) // or ‘storeDebug’ } Found in the official … Read more

How to add a Library Project to a android project?

File->New->Other Select Android Project Select “Create Project from existing source” Click “Browse…” button and navigate to johannilsson-android-actionbar\actionbar Finish (Now action bar project in your workspace) Right-click on your project -> Properties In Android->Library section click Add select recently added project -> Ok that’s it! Now you can use it