Skip to content

Instantly share code, notes, and snippets.

@mr-archano
Last active August 29, 2015 14:01
Show Gist options
  • Save mr-archano/fe491a604f1ef893a0db to your computer and use it in GitHub Desktop.
Save mr-archano/fe491a604f1ef893a0db to your computer and use it in GitHub Desktop.
crashlytics hack
...
File crashlyticsProperties = new File("${project.projectDir.absolutePath}/crashlytics.properties")
applicationVariants.all { variant ->
variant.productFlavors.each { flavor ->
def variantSuffix = variant.name.capitalize()
def generateResourcesTask = project.tasks.getByName("crashlyticsGenerateResources${variantSuffix}")
def generatePropertiesTask = task("crashlyticsGenerateProperties${variantSuffix}") << {
Properties properties = new Properties()
println "...copying apiSecret for ${variant.name}"
properties.put("apiSecret", flavor.crashlyticsApiSecret)
println "...copying apiKey for ${variant.name}"
properties.put("apiKey", flavor.crashlyticsApiKey)
properties.store(new FileWriter(crashlyticsProperties), "")
}
generateResourcesTask.dependsOn generatePropertiesTask
def cleanResourcesTask = project.tasks.getByName("crashlyticsCleanupResourcesAfterUpload${variantSuffix}")
cleanResourcesTask.doLast {
println "...removing crashlytics.properties"
crashlyticsProperties.delete()
}
}
}
...
@MNDaveC
Copy link

MNDaveC commented Jan 20, 2015

To cut to the chase, can you provide the entire build.gradle file example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment