@@ -112,22 +112,26 @@ android {
112112
113113 def localProperties = new Properties ()
114114 localProperties. load(new FileInputStream (rootProject. file(" local.properties" )))
115- def variantsArray = localProperties[' variantsUID' ]?. split(" ," )?. collect { it. trim() }
116- def variantsAsArrayString = ' new String[] {' + variantsArray. collect { " \" $it \" " }. join(" , " ) + ' }'
115+ def getPropertyOrEmpty = { key ->
116+ def value = localProperties. getProperty(key)
117+ return value != null ? " $value " : " \"\" "
118+ }
119+ def variantsArray = localProperties. getProperty(' variantsUID' )?. split(" ," )?. collect { it. trim() }
120+ def variantsAsArrayString = variantsArray ? ' new String[] {' + variantsArray. collect { " \" $it \" " }. join(" , " ) + ' }' : " new String[0]"
117121 buildTypes {
118122 debug {
119123 debuggable true
120124 testCoverageEnabled true
121125 proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
122126
123- buildConfigField " String" , " host" , localProperties[ ' host' ]
124- buildConfigField " String" , " APIKey" , localProperties[ ' APIKey' ]
125- buildConfigField " String" , " deliveryToken" , localProperties[ ' deliveryToken' ]
126- buildConfigField " String" , " environment" , localProperties[ ' environment' ]
127- buildConfigField " String" , " contentTypeUID" , localProperties[ ' contentType' ]
128- buildConfigField " String" , " assetUID" , localProperties[ ' assetUid' ]
129- buildConfigField " String" , " variantUID" , localProperties[ ' variantUID' ]
130- buildConfigField " String" , " variantEntryUID" , localProperties[ ' variantEntryUID' ]
127+ buildConfigField " String" , " host" , getPropertyOrEmpty( ' host' )
128+ buildConfigField " String" , " APIKey" , getPropertyOrEmpty( ' APIKey' )
129+ buildConfigField " String" , " deliveryToken" , getPropertyOrEmpty( ' deliveryToken' )
130+ buildConfigField " String" , " environment" , getPropertyOrEmpty( ' environment' )
131+ buildConfigField " String" , " contentTypeUID" , getPropertyOrEmpty( ' contentType' )
132+ buildConfigField " String" , " assetUID" , getPropertyOrEmpty( ' assetUid' )
133+ buildConfigField " String" , " variantUID" , getPropertyOrEmpty( ' variantUID' )
134+ buildConfigField " String" , " variantEntryUID" , getPropertyOrEmpty( ' variantEntryUID' )
131135 buildConfigField " String[]" , " variantsUID" , variantsAsArrayString
132136 }
133137 release {
0 commit comments