Resource overriding

I can't get resource overriding to work for device nor from jungle references.

What I want to do is to override drawables and settings for selected mip devices. So I included this code to the jungle file:

fenix8solar47mm.resourcePath = $(fenix8solar47mm.resourcePath);mip-resources
fenix8solar51mm.resourcePath = $(fenix8solar55mm.resourcePath);mip-resources
fenix7pronowifi.resourcePath = $(fenix7pronowifi.resourcePath);mip-resources
fenix7x.resourcePath = $(fenix7x.resourcePath);mip-resources
fenix7xpronowifi.resourcePath = $(fenix7xpronowifi.resourcePath);mip-resources
 
That didn't make a difference. So I made a step back in the process and tried basic resource overriding and again that didn't change anything in the simulator.
The language overriding for  strings however works perfectly.

* I have problems posting to the forum again so I'll try to post the image in the first reply

  • Take a look at the strings sample in the SDK and maybe add an override for the device you are having trouble will,  You'll notices there's nothing needed in the jungles file for this to work

  • I already got strings to work. I have problems with drawables.xml and properties.xml. As I want to have them on one place in the end I want to refer to them using the jungles file. Atm it's not working using the jungles file, but also not directing directly to the directories as the image shows. It keeps using the original drawables.xml and properties.xml

  • I'll try reorganising the directory tree like it is in the string sample.

  • Okay. I managed to work around solve it. It was not possible to override drawables.xml and properties.xml. As soon as I deleted them from the default resource directory the MIP redirect via jungles worked immediately.

    I have setup an amoled-resources directory besides the mip-resources directory for the 'default' drawables.xml and properties.xml

    This works:

    #mip resource mapping:
    fenix8solar47mm.resourcePath = $(fenix8solar47mm.resourcePath);mip-resources
    fenix8solar51mm.resourcePath = $(fenix8solar51mm.resourcePath);mip-resources
    fenix7pronowifi.resourcePath = $(fenix7pronowifi.resourcePath);mip-resources
    fenix7x.resourcePath = $(fenix7x.resourcePath);mip-resources
    fenix7xpronowifi.resourcePath = $(fenix7xpronowifi.resourcePath);mip-resources
    #amoled resource mapping:
    approachs7042mm.resourcePath = $(approachs7042mm.resourcePath);amoled-resources
    approachs7047mm.resourcePath = $(approachs7047mm.resourcePath);amoled-resources
    d2airx10.resourcePath = $(d2airx10.resourcePath);amoled-resources
    d2mach1.resourcePath = $(d2mach1.resourcePath);amoled-resources
    [etc]
     

    But is this a bug or a feature?

  • It depends what you are expecting to happen when you override resources. 

    If you are expecting entire files to be overridden (i.e. you want resources/drawables.xml and resources/properties.xml to be completely ignored, because the same files exist in mip-resources/), that's not how it works.

    The way it works is that resources (like strings) with the same ID are overridden. (And ofc any new resource IDs in the specified path are also used.)

    So any given resource in mip-resources/ should take precedence over a resource with the same ID in a default resources path (such as resources/), in your original example, for devices such as fenix7x.

    But any resource in a default resource path (such as resources/) which does not have the same ID as a resource in mip-resources will not be removed.

    When you use resource overrides in this way, you can only add or change default resources, you cannot delete default resources (if that's what you're trying to do).

  • Aaah of course, that's how the string definitions work too. However I never tried to get rid of strings. And now I wanted to get rid of some of the settings and unused bitmaps. Thanks!