Using excludeAnnotations in monkey.jungle for onLayout(dc)

I gave up on maintaining my app years ago because I could never figure out how to migrate to the newer ConnectIQ sdk that uses the jungle files.
I've decided to give it another try, but am finding it frustrating to find good explanations and examples on how to achieve different layouts for different devices.

I'd like to do something like this, but can't get it to work. This in my MyApp.mc file:
(:round_218x218) function onLayout(dc)
{
  width = dc.getWidth(); 
  myVariable = 10;
}
(:semiround_215x180) function onLayout(dc)
{
  width = dc.getWidth();
  myVariable = 20;
}
What do I put in monkey.jungle to make this work? I made a wild guess, and tried this:
project.manifest = manifest.xml

round_218x218.resourcePath = $(round_218x218.resourcePath);resources-round-218x218
semiround_215x180.resourcePath= $(semiround_215x180.resourcePath);resources-semiround-215x180

round_218x218.excludeAnnotations = semiround_215x180
semiround_215x180.excludeAnnotations = round_218x218
When I compile I get errors like:
'semiround_215x180' is not a valid device / family qualifier.
'semiround_215x180' is not a valid device / family qualifier.
'round_218x218' is not a valid device / family qualifier.
'round_218x218' is not a valid device / family qualifier.
  • I copied the monkey.jungle file from the Samples/Attention folder in my connectiq-sdk onto my monkey.jungle.. It looks like that is the only Sample that has a non-trivial monkey.jungle. I'm still getting "Duplicate declaration of symbol 'onLayout' in class 'MyClass'. So something is still missing.

  • "Duplicate declaration of symbol 'onLayout'

    FWIW - I have similar issue when qualifying a function that overrides a Garmin class function (like onLayout). One workaround might be to put a call in your onLayout to your function which has separate qualifiers 

  • I finally got it working.

    In my code, I have the three version of onLayout(), annotated like this:

    (:round_218x218) function onLayout(dc) {...}
    (:semiround_215x180) function onLayout(dc) {...}
    (:rectangle_205x148) function onLayout(dc) {...}

    In my monkey.jungle, I have this (not including other stuff like the resources):

    project.manifest = manifest.xml

    base.excludeAnnotations = rectangle_205x148;round_218x218

    vivoactive.excludeAnnotations = round_218x218;semiround_215x180
    d2bravo.excludeAnnotations = rectangle_205x148;semiround_215x180
    d2bravo_titanium.excludeAnnotations = rectangle_205x148;semiround_215x180
    fenix3.excludeAnnotations = rectangle_205x148;semiround_215x180
    fenix3_hr.excludeAnnotations = rectangle_205x148;semiround_215x180
    fr230.excludeAnnotations = rectangle_205x148;round_218x218

    One of the key things that I had been missing was the "base.excludeAnnotations = ..." line. Without that, I was getting the "Duplicate declaration ..." errors.