For an Android app, if my build.gradle
has 2 schemes, prod and qa, how can I choose a gradle_${chosen}.properties
based on the scheme? Ie in my build
prod {
//use gradle_prod.properties
}
qa {
//use gradle_qa.properties
}
If I try something like:
qa {
processResources{
// ...
}
}
I get could not find method processResources()
...
You can use a .properties
file using something like:
def Properties props = new Properties()
def propFile = file('../fileName.properties')
if (propFile.canRead()){
props.load(new FileInputStream(propFile))
xxx = file(props['MY_KEY'])
}
Instead if you want to use tasks defined in other .gradle
files you can use in your file:
apply from: 'myFilename.gradle'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.