Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-line strings in gradle.properties

I'm developing an Android app, and I don't want to put creds under source control. I'm defining some creds in my gradle.properties file, like so:

user="bob"
pass="123"

I then import them in my build.gradle file, like so:

buildConfigField('String', "user", user)
resValue('string', "user", user)

Then, I can access them from Java as if they were a normal String resource.

Unfortunately, I also need to include a multi-line string in my gradle.properties file. I've tried the following:

long_string="this is
a multi-line string"

However, when I try to build my project, I get an error message that I have an unclosed string literal.

The docs for gradle.properties don't seem to mention anything about multi-line string formatting.

Is what I want to do possible?

like image 411
John Chrysostom Avatar asked Mar 04 '23 13:03

John Chrysostom


1 Answers

You can also do this:

long_string="this is a \
multi-line string \
yay"
like image 190
Steven Avatar answered Mar 10 '23 20:03

Steven