android - Why are all my Gradle product flavors building? -


i have 2 product flavors in android project build gradle.

one of flavors declares dependency dependency used in both flavors. both flavors build, since 1 of flavors depends on library declared first flavor should not case.

since 1 of flavors pro version in end should not have admob sdk in apk fear reason both flavors add admob sdk.

i have following build.gradle file:

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 {                 compile files('src/free/libs/admob.jar')             }         }     } }  dependencies {     compile 'com.android.support:support-v4:18.0.+'     compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'     compile filetree(dir: 'libs', include: '*.jar') } 

the correct way add dependency 1 product flavor is:

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 {     compile 'com.android.support:support-v4:18.0.+'     compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'     compile filetree(dir: 'libs', include: '*.jar')     freecompile files('src/free/libs/admob.jar') } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -