Sid Sid - 28 days ago 11
Android Question

Can we edit the values.xml in .aar file to add strings for a particular language

I have just completed work on a small android apk with some 4 screens. I wanted to test it for different languages, so I added values-de folder and added strings for dutch language. It worked fine.
The problem is that we are shipping only the .aar file to the customer and we want him to add the specific strings for the language required by him. So I converted the .aar to a .jar,unzipped it and created a new folder values-fr and edited the values.xml inside this with dutch specific strings. This modified aar is now failing when imported in a sample app with errors as below:

C:\Locale\AuthenticationSDKIntegration\authsdkapp\build\intermediates\res\debug\values-fr\values.xml:79: error: Attribute "cb_color" has already been defined

So my question is is it possible that the customer somehow modify the .aar sgiven by us to add strings for his language?

Sid Sid
Answer Source

The right way if doing so is by adding the required strings in the strings.xml of the application code where the aar is being imported. So basically create a new folder values-langcode eg values-fr in the application code and the required value in the colors.xml or strings.xml. Note: If you add a string with a key which is already present in the aar the value will be overridden.