Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resulting path causes lint warning #1

Closed
gabrielittner opened this issue Nov 29, 2017 · 6 comments
Closed

Resulting path causes lint warning #1

gabrielittner opened this issue Nov 29, 2017 · 6 comments

Comments

@gabrielittner
Copy link

gabrielittner commented Nov 29, 2017

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

Fixed! Will publish within the next couple days.

@gabrielittner
Copy link
Author

Awesome, thanks

@alexjlockwood
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants