Android Question (SOLVED) Error in strings.xml

Johan Schoeman

Expert
Licensed User
Longtime User
I am using a strings.xml file in a B4A project

B4X:
<resources>
    <string name="app_name">SpeedTest </string>
    <string name="network_edge">Network : EDGE </string>
    <string name="network_3g">Network : 3G </string>
    <string name="network_detecting">Network : Detecting </string>
    <string name="update_speed">%s kbit/sec </string>
    <string name="update_downloaded">Downloaded %s of %s </string>
    <string name="update_connectionspeed">Connection time %s ms</string>
    <string name="update_downloaded_complete" formatted="false">Downloaded %s at %s kbit per sec</string>
</resources>

It generates the following error when compiling the B4A project:

B4A version 4.30
Parsing code. 0.00
Running custom action. 0.05
Compiling code. 0.03
Compiling layouts code. 0.00
Generating R file. Error
res\values\strings.xml:25: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
res\values\strings.xml:25: error: Unexpected end tag string

This line generates the error:

<string name="update_downloaded_complete" formatted="false">Downloaded %s at %s kbit per sec</string>

I have added formatted="false" but the error still come up. Does anyone have a solution for this?

EDIT: This fixed it
B4X:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
   
    <string name="app_name">SpeedTest</string>
    <string name="network_edge">Network : EDGE</string>
    <string name="network_3g">Network : 3G</string>
    <string name="network_detecting">Network : Detecting</string>
    <string name="update_speed">%s kbit/sec</string>
    <string name="update_downloaded" formatted="false">Downloaded %s of %s</string>
    <string name="update_connectionspeed">Connection time %s ms</string>
    <string name="update_downloaded_complete" formatted="false">Downloaded %s @ %s kbit/sec</string>
</resources>
 
Last edited:
Top