Fix error if properties files doesn't exist
This commit is contained in:
parent
da12ebdd0a
commit
da76f636ce
1 changed files with 9 additions and 3 deletions
12
build.gradle
12
build.gradle
|
@ -112,19 +112,25 @@ android {
|
||||||
// TODO
|
// TODO
|
||||||
def getSdkDir() {
|
def getSdkDir() {
|
||||||
Properties local = new Properties()
|
Properties local = new Properties()
|
||||||
local.load(new FileInputStream("${rootDir}/local.properties"))
|
if (new File("${rootDir}/local.properties").exists()) {
|
||||||
|
local.load(new FileInputStream("${rootDir}/local.properties"))
|
||||||
|
}
|
||||||
return local.getProperty('sdk.dir')
|
return local.getProperty('sdk.dir')
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTarget() {
|
def getTarget() {
|
||||||
Properties local = new Properties()
|
Properties local = new Properties()
|
||||||
local.load(new FileInputStream("${rootDir}/project.properties"))
|
if (new File("${rootDir}/project.properties").exists()) {
|
||||||
|
local.load(new FileInputStream("${rootDir}/project.properties"))
|
||||||
|
}
|
||||||
return local.getProperty('target')
|
return local.getProperty('target')
|
||||||
}
|
}
|
||||||
|
|
||||||
def getVersionName() {
|
def getVersionName() {
|
||||||
Properties local = new Properties()
|
Properties local = new Properties()
|
||||||
local.load(new FileInputStream("${rootDir}/default.properties"))
|
if (new File("${rootDir}/default.properties").exists()) {
|
||||||
|
local.load(new FileInputStream("${rootDir}/default.properties"))
|
||||||
|
}
|
||||||
return local.getProperty('version.name')
|
return local.getProperty('version.name')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue