alexjlockwood / avocado

🥑 Vector Drawable optimization tool 🥑
MIT License
1.35k stars 48 forks source link

Resulting path causes lint warning #1

Closed gabrielittner closed 6 years ago

gabrielittner commented 6 years ago

Original: android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"

Result: android:pathData="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"

Lint output:

/home/circleci/timetable/app/src/main/res/drawable/ic_action_delete.xml:2: Error: Use -0.9 instead of -.9 to avoid crashes on some devices [InvalidVectorPath]
    <path android:fillColor="?android:textColorPrimary" android:pathData="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>
                                                                                                       ~~~
/home/circleci/timetable/app/src/main/res/drawable/ic_action_delete.xml:2: Error: Use 0.9 instead of .9 to avoid crashes on some devices [InvalidVectorPath]
    <path android:fillColor="?android:textColorPrimary" android:pathData="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>
                                                                                     ~~
alexjlockwood commented 6 years ago

Sighs... is this a samsung thing or what... -.-

Anyway, thanks for reporting! I'll probably disable that particular optimization then... it shouldn't have any impact on rendering performance anyway.

Do you happen to know where the source code for these lint checks are, BTW? Trying to find it now... I wanna know if there are any other lint checks I should know about.

alexjlockwood commented 6 years ago

OK, cool, I found it: https://android.googlesource.com/platform/tools/base/+/40c903f5c9de8a8be09d82befdc355711347ccaf/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/VectorPathDetector.java

Looks like I should make sure the path strings don't contain scientific notation like 1e03 as well...

alexjlockwood commented 6 years ago

BTW, it looks like there is a quick fix in Android Studio that you can use to fix the lint warning... you know, until I publish the fix. :)

alexjlockwood commented 6 years ago

Fixed! Will publish within the next couple days.

gabrielittner commented 6 years ago

Awesome, thanks

alexjlockwood commented 6 years ago

Released this morning. Still gotta fix the scientific notation lint warning though (I created another bug for that).