Replace (or “Override”) String in Android Library Project

后端 未结 2 1593
南笙
南笙 2020-12-13 18:26

I\'ve been trying to make an android library project, and while the build process works fine, I\'ve been running into some trouble with replacing a resource in the project w

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 19:05

    Just had this error, here is what happened in my case :

    If you are using multiple strings.xml file for different screen sizes in your library, your app might use the library file.

    I.E, if you have :

    LIBRARY :  
        res/values/strings.xml  
        res/values-sw600dp/strings.xml
    

    and :

    APP :
        res/values/strings.xml
    

    And you try to launch your app on a 600dp screen size (i.e a tablet), your app is going to get the strings.xml(sw600dp) from your library.
    To avoid this, you might want to create a strings.xml specific to sw600dp resolutions in your app, that contains the same strings values than in your library.

提交回复
热议问题