Complete
over 3 years ago

Barrel build name needs to be the same in the manifest.

Thanks Jim!

Drawables, Strings or JSONData can't be used in Barrels

Using Visual Studio Code I'm not able to load resources from a Monkey Barrel. If a resource call is mistyped or not present I get a compilation error, but once it's referenced at runtime I get a "Symbol not found" error.

  • Thank you for your help Jim!

  • Found the issue! Barrel name in the manifest must be the same name of the top module of the barrel. No error was reported when building the app, but if I build the Barrel standalone I get errors.

    Maybe the ticket can be updated to return barrell build errors when building the app.

  • It's working the same for me with VS Code or Eclipse.  How are you building the barrel?  Barrels are different than other app types.  a .barrel is actually just a zip of the barrel project.  And you need the barrel to be added to your project.

  • The exact same setup in my case causes "Symbol not found" both in the barrel and the application. I have a string.xml file under in the directory <barrel root>/resources. Are you using Visual Studio Code? I have the feeling that it's a tool issue, because I get a compilation error if the string.xml file is not included in the barrel.

  • How are you trying to reference things?  As a simple test, I added a string to one of my barrels (it already has a custom font.)

    <strings>
    <string id="MyName">MyIcons</string>
    </strings>

    In the barrel, in its initialize, I can reference the string fine with this.  The module is named ClockIcons.

    Sys.println("CI "+Ui.loadResource(ClockIcons.Rez.Strings.MyName));

    and in the main app (a watch face) with this, again with the module name:

    Sys.println("SB "+Ui.loadResource(ClockIcons.Rez.Strings.MyName)); 

    on the console:

    CI MyIcons
    SB MyIcons