Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Lint Check - StringFormatInvalid: what is wrong on %d%% remaining?

Tags:

android

lint

I'm using Android Lint for checking my translated strings. I have a string

<string name='status_bar_text_remaining_capacity'>%d%% remaining</string>

Lint reports this

res/values/strings.xml:91: Error: Format string 'status_bar_text_remaining_capacity' is not a valid format string so it should not be passed to String.format [StringFormatInvalid]
<string name='status_bar_text_remaining_capacity'>%d%% remaining</string>

As far as I understand documentation for String.format() then this is valid string. Do you have any idea what is wrong?

like image 746
Tomáš Hubálek Avatar asked Dec 19 '12 09:12

Tomáš Hubálek


People also ask

How do you check for lint errors?

Run the lint tool on your module by right-clicking on your module folder or file in the Project View and selecting Analyze > Inspect Code. This displays the lint inspection results with a list of issues that lint detected in your module.

What is lint error android?

The lint tool helps find poorly structured code that can impact the reliability and efficiency of your Android apps and make your code harder to maintain. For example, if your XML resource files contain unused namespaces, this takes up space and incurs unnecessary processing.

How do I stop a lint warning?

To suppress a lint warning with an annotation, add a @SuppressLint("id") annotation on the class, method or variable declaration closest to the warning instance you want to disable.


1 Answers

This was a bug in lint which was fixed recently; https://android-review.googlesource.com/#/c/46741/1

The fix is in ADT 21.0.1.

like image 192
Tor Norbye Avatar answered Oct 03 '22 07:10

Tor Norbye