This is an error.
| |
Incorrect property escapes | |
Error | |
Correctness | |
Any | |
Android Open Source Project | |
Initial | |
Property files | |
This check runs on the fly in the IDE editor | |
2014 |
key=\\My\\Files.
Here is an example of lint warnings produced by this check:
local.properties:11:Error: Windows file separators (\) and drive letter
separators (':') must be escaped (\\) in property files; use
C\:\\my\\path\\to\\sdk [PropertyEscape]
windows.dir=C:\my\path\to\sdk
--------------
local.properties:14:Error: Windows file separators (\) and drive letter
separators (':') must be escaped (\\) in property files; use
C\:\\Documents and Settings\\UserName\\Local Settings\\Application
Data\\Android\\android-studio\\sdk [PropertyEscape]
ok.sdk.dir=C:\\Documents and Settings\\UserName\\Local Settings\\Application Data\\Android\\android-studio\\sdk
-
Here is the source file referenced above:
local.properties
:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/test/dev/sdks
windows.dir=C:\my\path\to\sdk
windows2.dir=C\:\\my\\path\\to\\sdk
not.a.path.prop=Hello \my\path\to\sdk
ok.sdk.dir=C:\\Documents and Settings\\UserName\\Local Settings\\Application Data\\Android\\android-studio\\sdk
You can also visit the source code for the unit tests for this check to see additional scenarios.
The above example was automatically extracted from the first unit test
found for this lint check, PropertyFileDetector.testBasic
.
To report a problem with this extracted sample, visit
https://issuetracker.google.com/issues/new?component=192708.
You can suppress false positives using one of the following mechanisms:
#noinspection PropertyEscape
key = problematic-value
lint.xml
file in the source tree which turns off
the check in that folder and any sub folder. A simple file might look
like this:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="PropertyEscape" severity="ignore" />
</lint>
Instead of ignore
you can also change the severity here, for
example from error
to warning
. You can find additional
documentation on how to filter issues by path, regular expression and
so on
here.
lintOptions {
disable 'PropertyEscape'
}
In Android projects this should be nested inside an android { }
block.
lint
, using the --ignore
flag:
$ lint --ignore PropertyEscape ...`