4 Replies Latest reply on Nov 11, 2011 12:19 PM by studiomutmo

    Flash Builder 4.5 the import could not be found

    Abram Adams Level 1
      I just upgraded from Flash Builder 4 to 4.5 and have imported  one of my FB 4 projects.  I am now seeing an orange question mark in  the gutter next to all of my import statements that are importing local  classes (as well as everywhere the said class methods are used) and an  orange underline appears under the import statement.  When I hover over  the underline it says that the import could not be found.

       

      The class files do in fact exist and the project compiles and runs without a problem (I use ANT to build this project).

       

      If I open one of the class files in question then change something  (i.e press space bar) and hit save then go back to the file importing it  the orange question mark is gone for that import, I get the code assist  and CTL+Click links me to the class file.  However, if I close that  file and reopen it again cannot find the class file.

      The classes in question are stored under my project's src dir as:

       - src
       
      +---com
           
      +---myappname
               
      +---services
               
      +---utils
                etc
      ...

      and my import statements look like:


      import
      com.myappname.utils.*;
      import com.myappname.services.remoteService;

       

      Any ideas?  Is this a FB 4.5 "enhancement"?  I've tried deleting and  re-importing the project, refreshing the project and am now kind of at a  loss of what to do.  It's annoying enough that I may need to downgrade  to 4.

        • 1. Re: Flash Builder 4.5 the import could not be found
          srvikram13 Level 1

          Just faced the exact same problem.

          Well have to say, I was expecting the solution to this problem somewhere on the Internet.

           

          Anyways, here's the reason-

          The project you imported was created using an older version of the Flex sdk(possibly 3.5 or something). Flash Builder 4.5 supports sdks from 3.6 & upwards. And, that's where your problem lies.

           

          Here is the solution-

           

          Goto Project > Properties > Select 'ActionScript Compiler'.

           

          In the dialog box on right-hand side, under 'Use a specific SDK' select Flex 3.6 or higher.

           

          It will show a confirmation box when you apply these settings informing about the changes it will cause. Do not bother just Apply the changes and Voila!

          It comes back to life

           

          Hope that helps!

          • 2. Re: Flash Builder 4.5 the import could not be found
            Abram Adams Level 1

            Thanks for the reply srvikram13, I really appreciate it.

             

            Unfortunately this did not solve my problem.  The application was developed in Flex sdk 4.1 and I have installed the 4.1 sdk and told the Flex Compiler to use that specific sdk to no avail (I even re-tried per your post, but no success).  The fact is that the project compiles fine with either 4.1 or 4.5 sdk, it just has issues finding the imorted classes until I manually open the class files.

             

            Further debugging and info:

             

            I actually thought I had it fixed for a second.  I renamed my "com" directory and right clicked on "src" and chose "New" > "Package" then repeated that for each directory under "com".  I then closed FB and in windows explorer copied my original com directories into the new one created by FB.  When I launched FB and opened the main file all my imports were recognized!  I then closed FB and re-opened again to see if it was truly fixed and ... epic fail.  The squiggly underlines are back and FB doesn't recognize any reference to them.

             

            I also found that even if I navigate to the class files in the Package Explorer then right click on the file and choose properties, then click cancel (never opening or changing anything) the reference to that specific file is now valid... at least until I close and reopen FB.


            Any other ideas?

            • 3. Re: Flash Builder 4.5 the import could not be found
              Abram Adams Level 1

              Fixed!

               

              The project in question is a Flex/Air application and includes a  folder inside the default "src" folder that houses a web application  server (railo) that runs locally when the Air app is launched to provide  "server side" functionality to the Air client.  This folder was only in  the src folder so that it would be packaged in the Air installer.   However, I found that if I remove the directory, all my import  references start to work just fine.

               

              I still needed the folder inside src folder so that it would package  properly, so I simply moved it to the project root (outside of src) then  created a "link" to it in the src folder.  This keeps my import  references intact, and includes the folder in the exe build.

               

              I'm not sure why including that folder causes this problem (it does  not include any AS3 or MXML files), but I'm thrilled that it was an easy  fix.

              • 4. Re: Flash Builder 4.5 the import could not be found
                studiomutmo

                I see the problem has been fixed, but I ran into a similar issue when creating a Flash Builder project from a project created in the Flash IDE.

                 

                My Flash IDE project was converted when I selected Flash Builder as the default .as editor, and a Flash Builder project was created. I suspect I wasn't specific enough when specifying the source paths, or the conversion defaulted to some values that caused the issue.

                 

                For me, the issue was happening to both the classes found in flash.* package and to my classes. My project would run, but it became cumbersomet to debug the project because the question marks for each line layed over any breakpoints.

                 

                I solved the problem by updating the path to the globalplayer.swc in the project settings. For some reason, this swc was listed in the old 8.3 Windows filename format and did not point to the same file that my other projects did. I also added, as a source path, the directory that contained my class files, which had been created as a link to a directory instead of a source path.