Gradle build scripts are written in Groovy. Groovy has both double-quoted and single-quoted String literals. The main difference is that double-quoted String literals support String interpolation:

def x = 10
println "result is $x" // prints: result is 10

You can learn more about Groovy String interpolation in this or other Groovy articles on the web.


Yes, you can use one or the other. The only difference is that double-quoted strings can be GStrings, which can contain evaluated expressions like in the following example taken from the Groovy documentation:

foxtype = 'quick'
foxcolor = ['b', 'r', 'o', 'w', 'n']
println "The $foxtype ${foxcolor.join()} fox"
// => The quick brown fox

According to the gradle docs:

Favor single quotes for plain strings in build script listings

This is mostly to ensure consistency across guides, but single quotes are also a little less noisy than double quotes. Only use double quotes if you want to include an embedded expression in the string.