// // Configuration file for gradle build execution. // task apiKey { def tokenFile = new File("${projectDir}/src/main/res/values/developer-config.xml") if (!tokenFile.exists()) { String apiKey = "$System.env.MLN_API_KEY" if (apiKey == "null") { System.out.println("You should set the MLN_API_KEY environment variable.") apiKey = "YOUR_API_KEY_GOES_HERE" } String tokenFileContents = "\n" + "\n" + " " + apiKey + "\n" + "" tokenFile.write(tokenFileContents) } } gradle.projectsEvaluated { preBuild.dependsOn('apiKey') }