Android crashes are often caused by a resource containing %1$ s
when %1$s
was intended.
To my surprise, Android Studio does not show these syntax errors:
↑ The real syntax error above is the %1$ s
(makes the app crash), not the ellipsis that Android Studio highlights.
How to check for resource variable typos in Android Studio?
I am looking for the equivalent of lint --check StringFormatInvalid
.
Context: Many semi-automatic language translation tools break variables, making apps crash.
in Intellij it is possible to create custom inspections. I am not sure if it is possible in Android Studio.
Follow the link: https://www.jetbrains.com/idea/help/creating-custom-inspections.html
edit:
after follow the steps in the link you see in the next image my created inspection:
In the next image you see the basic configuration of the inspection:
In the next two images you see the setting of the variables. Only the used regex is not the ready. You must write it for general variable using (between $ and . is a space):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With