Error retrieving strings from SharedResources

I am in the process of trying to move our team to using IntelliJ for our Adobe Flex application. The application builds fine from the command line (mvn) or when compiling from within Adobe's Flash Builder. However, I am getting the following error when compiling from IntelliJ:

Error:[ui-vcloud-lib]: could not find source for resource bundle SharedResources.

However, this error only happens when building from within IntelliJ. When an official build is kicked off, mvn is able to compile the project without a problem.
Screen Shot 2015-12-15 at 5.16.53 PM.png
From the comment in the existing code (above), it looks like SharedResources should be provided by the SDK.  I found this version of SharedResources.properties online, https://apache.googlesource.com/flex-sdk/+/NewDPIBuckets/frameworks/projects/framework/bundles/en_US/SharedResources.properties.


What is SharedResources? Is it no longer valid in some version of the Flex SDK? Why would it work on Adobe Flash Builder? Intellij and Flash Builder are both pointing to the same location for the Flex SDK (4.1).

Thanks

4 comments
Comment actions Permalink

SharedResources.properties bundle is located in [Flex SDK]/frameworks/locale/[any locale]/framework_rb.swc and is added to the compiler classpath by default. You could occasionally wipe it out from the classpath by tweaking Compiler Options or using additional compiler configuration file. Please attach a screenshot of Project Structure | Modules | ui-vcloud-lib module | its build configuration subnode | Compiler Options tab and attach ui-vcloud-lib.iml file and additional compiler configuration file (if used).

0
Comment actions Permalink

Hello Alexander,


Thanks for your help. I did find the locale files under /bldmnt/toolchain/noarch/adobe-flex-sdk-4.1/frameworks/locale/en_US. I also went to the Compiler options and added "en_US ". All the other settings were created when I imported the .project files that were used for Adobe Flash Builder. Ading "en_US" did fix the compile error; however, the squiggly red mark under  "[ResourceBundle("SharedResources")]"  is still there.


The additional compiler options are set to ( The paths were not working when I initially tried it, I changed the paths to use $MODULE_DIR$ and IntelliJ automatically expanded them for me, which is bad because I wanted to be able to generate that file).

-load-config+=/Users/jmendes/p4client/spmain2/ui/ssui/ui-vcloud-lib/.flexConfig.xml -include-sources /Users/jmendes/p4client/spmain2/ui/ssui/ui-vcloud-lib/target/LibraryClasses.as /Users/jmendes/p4client/spmain2/ui/ssui/ui-vcloud-lib/src/main/generated-flex -include-namespaces http://cx.vmware.com/2009/vcloud

Screen Shot 2015-12-16 at 9.01.55 AM.png


I was actually getting a similar problem for our own resources files and I "fixed" it by marking the "locale" folder under as a src root. Didn't seem right but it got me past the compiler error. Hopefully I'm just incorrectly telling it how to find the locales.

Screen Shot 2015-12-16 at 9.05.16 AM.png

The .flexConfig file contains the following:

 
<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">

   <compiler>
      <locale>
         <locale-element>ko_KR</locale-element>
         <locale-element>zh_TW</locale-element>
         <locale-element>en_US</locale-element>
         <locale-element>it_IT</locale-element>
         <locale-element>ja_JP</locale-element>
         <locale-element>de_DE</locale-element>
         <locale-element>es_ES</locale-element>
         <locale-element>fr_FR</locale-element>
         <locale-element>zh_CN</locale-element>
      </locale>
      <keep-as3-metadata>
         <name>AppEvent</name>
         <name>ArrayElementType</name>
         ...
         <name>Response</name>
         <name>PageId</name>
      </keep-as3-metadata>
      <theme><filename>${flexlib}/libs/spark.swc</filename></theme>            
   </compiler>
   
   <metadata>
   </metadata>
   
</flex-config>
0
Comment actions Permalink

adobe-flex-sdk-4.1

Do you really have to work with that ancient SDK? I do not have it in hands to play with. May be the problem will go away if you switch to more recent SDK.
Try to create a brand new project that has a single Flash build configuration of Library (SWC) type and contains the only one source file that contains 'ResourceManager.getInstance().getString("SharedResources", "dateFormat")'. Will it compile?

Meanwhile I have one more idea how to fix your compileation problem. Open Dependencies tab and click [+] -> New Library -> Select path to [Flex SDK]/frameworks/locale/en_US

I was actually getting a similar problem for our own resources files and I "fixed" it by marking the "locale" folder under as a src root.

This is a right way to go. Well, the most straight forward way is that:
- you mark all subfolders of your locals folder as a source root
- you list all locales in Compiler Options tab
- you do not specify locales and source paths anywhere else, including Additional Compiler Options or Additional Compiler Configuration file

Specifying Additional Compiler Options and Additional Compiler Configuration file usually works well. But this way it is possible to set the same compiler option in 3 ways: un IDE UI, as additional options, inside additional compiler options file. In some cases if the same option is set in different ways it may lead to a conflict with unexpected result.
0
Comment actions Permalink

Do I have to use the ancient SDK? I'm not 100% sure, I know that it wasn't part of the plan to upgrade the SDK. The codebase is really big and we are writing an HTML replacement app for it, I'm already getting grief for trying to switch to IntelliJ. We'd have to make sure it would still work well under Adobe Flash Builder and Maven, it may be worth a try but that didn't help with finding the SharedResources file.


However, adding a dependency to "framework_rb.swc" did fix my problem. I'm hoping we only have one problem left before we can move to IntelliJ and I'll ask about it in a separate question so that it can be more helpful to other forum users.

Screen Shot 2015-12-16 at 10.17.42 AM.png

Thanks a lot,

--Juan Mendes

0

Please sign in to leave a comment.