Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to override android string resource from external aar library?

I have a project that depends on third-party library (aar). I want to change some strings in this library (they are defined in strings.xml of the library). Is it possible to override these string values without dealing with library source code? (id of the string resource is known).

like image 813
wilddev Avatar asked Mar 09 '23 05:03

wilddev


1 Answers

Yes, you can do it, but you have to override all languages in which the string is written.

Assume that the following string is in a third-party library in res/values folder.

<string name="msg">Message</string>

And this is in the library res/values-it folder:

<string name="msg">Messaggio</string>

You have to override both in your app, so, in your res/values folder, you can do:

<string name="msg">My new string</string>

And in res/values-it, you can do:

<string name="msg">La mia stringa</string>
like image 69
Giorgio Antonioli Avatar answered Apr 07 '23 06:04

Giorgio Antonioli