I have a drawable file with the IconDipSize
Lint issue.
This issue is suppressed in lint-baseline.xml
file generated on macOS machine, so that it contains file paths with slash, instead of Windows-style backslash.
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.0.1" client="gradle" variant="betaDebug" version="4.0.1">
<issue
id="IconDipSize"
message="The image `download_icon.png` varies significantly in its density-independent (dip) size across the various density versions: drawable-hdpi/download_icon.png: 32x32 dp (48x48 px), drawable-mdpi/download_icon.png: 72x72 dp (72x72 px), drawable-xhdpi/download_icon.png: 48x48 dp (96x96 px), drawable-xxhdpi/download_icon.png: 48x48 dp (144x144 px), drawable-xxxhdpi/download_icon.png: 48x48 dp (192x192 px)">
<location
file="src/main/res/drawable-hdpi/download_icon.png"/>
<location
file="src/main/res/drawable-xxxhdpi/download_icon.png"/>
<location
file="src/main/res/drawable-xhdpi/download_icon.png"/>
<location
file="src/main/res/drawable-xxhdpi/download_icon.png"/>
<location
file="src/main/res/drawable-mdpi/download_icon.png"/>
</issue>
</issues>
This causes lint to ignore the suppression and throw an error:
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
The first 3 errors (out of 6) were:
C:\Users\piotr\StudioProjects\pnp-android\app\src\main\res\drawable-hdpi\download_icon.png: Error: The image download_icon.png varies significantly in its density-independent (dip) size across the various density versions: drawable-hdpi\download_icon.png: 32x32 dp (48x48 px), drawable-mdpi\download_icon.png: 72x72 dp (72x72 px), drawable-xhdpi\download_icon.png: 48x48 dp (96x96 px), drawable-xxhdpi\download_icon.png: 48x48 dp (144x144 px), drawable-xxxhdpi\download_icon.png: 48x48 dp (192x192 px) [IconDipSize]
Removing the lint-baseline.xml
file and running Lint once again to regenerate it, solves the issue, because baseline with Windows style paths is generated:
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.0.1" client="gradle" variant="betaDebug" version="4.0.1">
<issue
id="IconDipSize"
message="The image `download_icon.png` varies significantly in its density-independent (dip) size across the various density versions: drawable-hdpi\\download_icon.png: 32x32 dp (48x48 px), drawable-mdpi\\download_icon.png: 72x72 dp (72x72 px), drawable-xhdpi\\download_icon.png: 48x48 dp (96x96 px), drawable-xxhdpi\\download_icon.png: 48x48 dp (144x144 px), drawable-xxxhdpi\\download_icon.png: 48x48 dp (192x192 px)">
<location
file="src\main\res\drawable-hdpi\download_icon.png"/>
<location
file="src\main\res\drawable-xxhdpi\download_icon.png"/>
<location
file="src\main\res\drawable-xxxhdpi\download_icon.png"/>
<location
file="src\main\res\drawable-xhdpi\download_icon.png"/>
<location
file="src\main\res\drawable-mdpi\download_icon.png"/>
</issue>
</issues>
However I don't find it a full solution to the problem as there are a few developers on the project, some of them on macOS, some on Windows and we want to avoid keeping separate lint-baseline.xml
files for each platform.
The question is: Is it possible to make Lint on Windows correctly resolve Linux/macOs style paths with slashes?