box
box

Reputation: 4688

Android Gradle separate variables

I have a large gradle file and now I want to have a separate gradle file that contains only constants. As I understood I just had to create a constants.gradle file and use:

apply from: 'constants.gradle'

in my main build.gradle file

My constants.gradle file contains:

def MY_VARIABLE = 1

If I want to reference that variable in build.gradle i get the following error:

"Could not find property ..."

EDIT: I want to use this variable as a buildConfigField in each product flavor

Upvotes: 1

Views: 122

Answers (1)

box
box

Reputation: 4688

Ok I think I found something that answers my question. I'm attaching a link to this nice article: http://saulmm.github.io/squeezing-gradle-builds/

I was trying to solve the problem in a different way that this article does.

Upvotes: 1

Related Questions