From 308ae33ab3298ae7cbe5837a6bf15ccd63e3be2c Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Mon, 18 Jun 2018 01:16:47 +0530 Subject: Added custom app name validation --- app/build.gradle | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 52ea901b..3eb948bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ import java.util.regex.Matcher import java.util.regex.Pattern apply plugin: 'com.android.application' +def appName = '' android { compileSdkVersion 27 @@ -57,9 +58,10 @@ android { custom { dimension "mode" //Change the package name as needed - applicationId "org.sample.custom" + applicationId "org.sample.customs" //Set app name here - resValue "string", "app_name", "Bitmask Custom" + appName = "Custom" + resValue "string", "app_name", appName //Change the versionCode as needed versionCode 1 //Change the versionName as needed @@ -381,3 +383,12 @@ task checkApplicationIdForCustomFlavor (type: Exec ) { } } } + +task checkAppNameForCustomFlavor (type: Exec ) { + def currFlavor = getCurrentFlavorForBetaOrRelease() + if(currFlavor.contains("custom")) { + if (appName.equalsIgnoreCase("custom")) { + throw new ExecutionException("ERROR: please change the appName(Custom) if you want to build a custom branded app!") + } + } +} \ No newline at end of file -- cgit v1.2.3