android - How to define different dependencies for different product flavors -
i converting 1 of apps gradle , use new build flavor features have paid , free ad based flavor.
i want ad based version depend on admob sdk.
my build file looks this:
buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavencentral() } android { compilesdkversion 18 buildtoolsversion "18.0.1" defaultconfig { minsdkversion 10 targetsdkversion 18 } productflavors { pro { packagename "de.janusz.journeyman.zinsrechner.pro" } free { dependencies { } } } } dependencies { compile 'com.android.support:support-v4:18.0.+' compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' compile filetree(dir: 'libs', include: '*.jar') }
is there way configure dependency in free product flavor have own libs folder merged main libs folder contains general libraries both flavors?
if possible how define folder?
to define flavor specific dependency can use procompile
instead of compile
in dependency section. when run gradle properties overview of automatic created configurations.
the correct build file looks this:
buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } apply plugin: 'com.android.application' repositories { mavencentral() } android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { minsdkversion 10 targetsdkversion 22 } productflavors { pro { packagename "de.janusz.journeyman.zinsrechner.pro" } free { } } } dependencies { compile 'com.android.support:support-v4:22.2.0' freecompile 'com.google.android.gms:play-services-ads:7.5.0' }
Comments
Post a Comment