Last active
August 29, 2015 14:01
-
-
Save mr-archano/fe491a604f1ef893a0db to your computer and use it in GitHub Desktop.
crashlytics hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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() | |
} | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To cut to the chase, can you provide the entire build.gradle file example?