Last active
July 3, 2016 13:11
-
-
Save vsvankhede/3a63b4615a37b8b9140bcbe9b9f1c2c4 to your computer and use it in GitHub Desktop.
Sample of using productFlavours.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion "23.0.1" | |
defaultConfig { | |
applicationId "com.example.pf" | |
minSdkVersion 15 | |
targetSdkVersion 23 | |
versionCode 1 | |
versionName "1.0" | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
productFlavours { | |
free { | |
applicationId "com.example.pf.free" | |
} | |
paid { | |
applicationId "com.example.pf.paid" | |
} | |
mock { | |
applicationIdSuffix = ".mock" | |
} | |
} | |
// Remove mockRelease | |
android.variantFilter { variant -> | |
if(variant.buildType.name.equals('release') | |
&& variant.getFlavors().get(0).name.equals('mock')) { | |
variant.setIgnore(true); | |
} | |
} | |
} | |
dependencies { | |
compile 'com.parse.bolts:bolts-tasks:1.3.0' | |
... | |
... | |
proCompile 'com.android.support:design:23.1.1' | |
freeCompile 'com.parse:parse-android:1.12.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
productFlavours { | |
free { | |
} | |
paid { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.variantFilter { variant -> | |
if(variant.buildType.name.equals('release') | |
&& variant.getFlavors().get(0).name.equals('mock')) { | |
variant.setIgnore(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.parse.bolts:bolts-tasks:1.3.0' | |
proCompile 'com.android.support:design:23.1.1' | |
freeCompile 'com.parse:parse-android:1.12.0' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment