“Internal Build Error” or “Classes Must Not Be Nested” error
June 21, 2007
Lately I’ve been seeing these errors in Flex Builder and not been able to find any good reason why they’re happening. It seems like the errors alternate – sometimes it’s one, sometimes it’s several of the other – and there’s no easy way to figure out why they’re happening. Usually they’ll go away if you clean the project enough, but that’s a huge waste of time, so I’ve spent a few hours scouring my code and removing anything that might be causing the errors.
I’ve found that these errors can be caused by several different conditions. FlexBuilder doesn’t handle them well (indeed it seems to have exceptions in either it’s own environment or the compiler), so you get this generic error message instead of something useful.
Here’s a list of problems that I’ve found that can cause these errors. Hit up the comments if you have any others:
1. Forgetting the semi-colon at the end of your member variables.
Michael Imhoff documented this one first. For some reason, flex builder doesn’t flag this as an error while coding, and it doesn’t throw exceptions in the build if you manage to make it compile.
2. Having the same namespace listed twice with different extensions in your mxml
so this:
<Component
xmlns=”com.site.stuff.core.*”
xmlns:fanui=”com.site.stuff.core.*”
xmlns:mx=“http://www.adobe.com/2006/mxml”
creationComplete=”onCreationComplete()”>
should be this:
<stuff:Component
xmlns:stuff=”com.site.stuff.core.*”
xmlns:mx=“http://www.adobe.com/2006/mxml”
creationComplete=”onCreationComplete()”>
or with the default namespace declared, obviously – as long as there’s only one namespace linked to com.site.stuff.core.*.
3. Having the same import declared twice in an AS file or embedded AS in an mxml file
4. Commenting out certain lines of code and rendering trace statements unreachable.
I’ve never seen this, but it was documented as one way to get the error on Flex Coders.
According to Matt Chotin in response to the FlexCoders listing, this is a documented issue. Hopefully it will be fixed in Flex 3.
Until then, good luck!
Entry Filed under: flex. .
40 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
Hrundik | June 27, 2007 at 8:36 am
Aah
Got this error again and can’t fix it now. Previously it disappered, now it stays… Google gave me your post on this error, but i can’t find the errors mentioned in my project. Shit…
2.
Hrundik | June 27, 2007 at 9:14 am
hmm. my case was:
[Bindable]
[Embed(source="assets/icons.swf", symbol="online")]
private var onlineIconClass:Class;
[Bindable]
[Embed(source="assets/icons.swf", symbol="offline")]
private var offlineIconClass:Class;
[Bindable]
[Embed(source="assets/icons.swf", symbol="away")]
private var awayIconClass:Class;
[Bindable]
[Embed(source="assets/icons.swf", symbol="na")]
private var naIconClass:Class;
[Bindable]
private var statuses:ArrayCollection = new ArrayCollection([{label:"Online", icon:onlineIconClass},{label:"Away", icon:awayIconClass}, {label:"Not Available", icon:naIconClass},{label:"Offline", icon:offlineIconClass}]);
3.
ventodimare | July 23, 2007 at 10:48 am
Hello, In my case I solved the problem inserting the right name of the function.
I had:
but instead of declare the method:
public function resultsPreviewExcelHttpService(event:ResultEvent):void{
}
I declared the method with a wrong name like:
public function previewExcelHttpService(event:ResultEvent):void{
}
The compiler crashes as descripted in your posts. Only when I called in the right way the method, my problem ended.
Hope this helps someone
4.
RJ | July 23, 2007 at 11:37 am
That definitely helps – thanks!
It’s unforunate that all of these errors can somehow cause this weird compiler issue. it makes it very very difficult to debug.
I just left the project we were experieincing the issues on, and we never fully solved them. We found that if you compile the application in stages it worked fine, but trying to do a clean build of all of the classes in the application (and there were a lot of them) always resulted in the error.
So that’s another tip – try commenting your application in stages. Comment out references to a lot of your classes and see if the application will compile. If it does, remove references to some classes in stages. Hope that helps – I know it’s not practical for every application.
5.
Wellness | August 7, 2007 at 3:03 pm
Hey
I was surfing the web and i saw this site, pretty cool.
Currently im running and adult site:Wellness
k, just want to say hi
Can i link you from my site? im looking for quality content like yours. If no let me know if i can add u in exchange for a montly fee or something.
6.
ericsoco | August 17, 2007 at 4:30 pm
not sure exactly what the offending line of code was, as commenting and then uncommenting a line didn’t always revert the error. sometimes uncommenting out line N in a build with no errors would create an “Internal build error”, and then commenting it back out would not remove that error but then create a “Classes must not be nested” error.
anyway, these lines caused one or both of the above errors:
var subcontainerId:int = Math.floor(v/Space.FORM_SUBCONTAINER_SIZE) * Math.floor(this.levelModel.numCols/Space.FORM_SUBCONTAINER_SIZE) + Math.floor(u/Space.FORM_SUBCONTAINER_SIZE);
var subcontainer:Sprite = (entity.bMobile ? this.formSubcontainers_mobile : this.formSubcontainers_static)[subcontainerId] as Sprite;
subcontainer.addChild(f);
i changed my syntax to the following, and now all is peachy:
var subcontainerId:int = Math.floor(v/Space.FORM_SUBCONTAINER_SIZE) * Math.floor(this.levelModel.numCols/Space.FORM_SUBCONTAINER_SIZE) + Math.floor(u/Space.FORM_SUBCONTAINER_SIZE);
var scArray:Array = (entity.bMobile ? this.formSubcontainers_mobile : this.formSubcontainers_static);
var subcontainer:Sprite = scArray[subcontainerId] as Sprite;
subcontainer.addChild(f);
ah well, my code is more readable now anyway. maybe the compiler was just complaining about that ugly ternary statement.
7.
Brooks Hollar | October 3, 2007 at 9:36 am
I found another condition that produces this same symptoms…:
var string:String = "this can be " +
+ "hard to see on two lines."
var string2:String = "easy to see " + + "on one line"
Hope this can can save some other poor soul out there the day I lost tracking this down!
8.
RJ | October 3, 2007 at 1:33 pm
Everyone – update to the latest FB3! This should fix a lot of the issues. If you still see them, please log the issues on the Flex issue tracker:
https://bugs.adobe.com/jira/secure/IssueNavigator.jspa?
Include the stack trace from the error file, if you can find it!
9.
MarkaLot | October 15, 2007 at 9:59 am
I just solved my problem. My situation is new swf file in the swfloader contains classes that can not be found in the main application, But you have to comment out some of the portion to let the compiler start telling you what is missing. Hope this can help.
10.
Brian | October 17, 2007 at 2:06 pm
We ran into this issue and fixed it by making the following aforementioned changes:
– Adding semicolons where missing
– Removing duplicate namespace imports from MXML files
– Removing duplicate import statements from AS files
Plus a few things not mentioned:
– Avoiding classes which extend MXML components
– Increasing JVM memory allocation in FlexBuilder.ini
We edited Progra Files/Adobe/FlexBuilder 2.0/FlexBuilder.ini and changed the middle two lines from this:
-Xms128M
-Xmx512M
To this:
-Xms256M
-Xmx1024M
I hope this helps someone,
Brian
Team Picnik
11.
RJ | October 17, 2007 at 3:26 pm
Thanks Brian – that definitely helps.
12.
Ramses Moreno | October 27, 2007 at 10:32 pm
Hi. In my case the error was produced by a XML:
WRONG:
CORRECT
Done.
13.
Ramses Moreno | October 27, 2007 at 10:33 pm
Sorry for the blank code, I mean, I set up an attrinute in an XML like:
attribute=true
and it should be:
attribute=”true”
14.
rjowen | November 4, 2007 at 5:15 pm
Stop internal build errors: vote for this:
https://bugs.adobe.com/jira/browse/FB-10565
15.
zbabin | January 22, 2008 at 2:04 am
putting a throw statement and after it placing code, can cause internal error build sometimes.
16.
JATH | January 30, 2008 at 6:29 pm
public var campFechaNacimiento:String=campFechaNacimiento=this.BusqFechaNac.text;
that was the problem, later i delete campFechaNacimiento the problem go away,,,… that is the problem of the copy paste.
17.
Milos Zikic | February 26, 2008 at 6:43 am
I have found one more thing causing this error. It is very ugly because it is not easy to find out what is causing it. Flex compiler reports this error on empty switch body:
More details:
http://miloszikic.blogspot.com/
18.
Alex Barton | March 20, 2008 at 3:45 am
Hi,
I’m getting the same error and I can’t work out why. The code is super simple.
Anyone got any ideas?
Cheers
19.
Alex Barton | March 20, 2008 at 3:45 am
Sorry about that…
Tried to leave code….
Here it is
20.
Alex Barton | March 20, 2008 at 3:46 am
?xml version=”1.0″ encoding=”utf-8″?>
21.
Martin Mc | March 30, 2008 at 12:40 pm
It was a switch statement with the body commented out that created this error for me.
22.
Martin | May 2, 2008 at 3:29 am
mine was:
var someObject = SomeClass = null:
——————–^
23.
ZaBlanc | May 9, 2008 at 8:39 am
As with Martin Mc above, this will get ya every time:
switch(name) {
}
Never leave a switch statement empty!
24.
Robmcm | May 15, 2008 at 8:10 am
I had this same problem it ended up being an empty swith statement.
Looked like so:
swith (myVar){
}
25.
Aaron Hardy | June 19, 2008 at 5:32 pm
Mine was this:
labelText=”Tagline{ + (!defaultsEditorMode ? ‘ (Optional)’ : ”)}:”
Notice the plus sign right after the binding open bracket.
26.
Bas Vijfwinkel | October 24, 2008 at 8:36 am
A misplaced ‘break’ statement caused this problem in my code.
I appended some code to a case statement without removing the break statement.
If you place a break statement in the middle of the code inside a case statement and if after this statement a (duplicate) variable is defined and later on defined again, then this error will occur in some cases.
27.
Tom Van den Eynde | November 7, 2008 at 7:45 am
I had my part of it (with Flex 3.0.1): I referred to a non-existing component from within an inline itemRenderer.
28.
Jon | November 23, 2008 at 5:58 pm
I had the same error. For me the problem was that I was trying to define variables in an interface rather than methods.
E.g.
This is WRONG…
public interface IDbItem
{
var Id: int;
}
This is RIGHT…
public interface IDbItem
{
function get Id(): int;
}
And even though it is defined as a method in the interface it can be fulfilled with a variable in the concrete class.
public class Person implements IDbItem
{
public var Id: int;
}
Hope that helps someone.
29.
krdr | December 2, 2008 at 2:49 am
I had problem with line:
private var m_nodes:Vector. = new Vector(3).;
————————————————————–^
It should be:
private var m_nodes:Vector. = new Vector.(3)
30.
David | December 4, 2008 at 7:24 am
Great resource!
I had the Internal Build Error” or “Classes Must Not Be Nested” (on the main app) errors because of referencing a non-existing component from within an inline itemRenderer deep within the view.
31.
ZPiDER | January 9, 2009 at 7:53 am
In my case (and from what i have read here this might be true for others) it was a COMBINATION of +2 problems:
1. i had errors in my code (i dont think it matters which errors, for what its worth, they were in a file of the same package as in 2.)
2. i had an .as file in my structure with a wrong package name
when i removed the file it showed me the other errors.
so for me it comes down to a copy-file-mishap..
32.
DavidW | January 29, 2009 at 2:37 pm
Spent a long time trying to track this down. For me it came down to: UPDATE THE COMPILER VERSION from within FlexBuilder. There was code that wasn’t running properly in the older version.
33.
Christina | April 22, 2009 at 6:17 am
I had the same error too. In my case problem occurred while I was trying to define two methods with different namespaces in my class. After different manipulations to fix this I was tired and confused. Last thing I did was the cleaning project and error has gone
For now I don’t know why this error occurred to me… Maybe, someone has the same situation?
34.
James | April 27, 2009 at 8:34 pm
We isolated the issue to be with shape tween in a swc.
35.
Deepak | May 10, 2009 at 12:07 pm
I had a free floating variable like this declared in an ActionScript file
public var xmlAttrList:XMLList = loadedXml.books.book.authors.author.(@first == “Monica”);
I was including this .as file in a .mxml file. The compiler didn’t like the E4X filtering (although other more basic E4X features seemed to work)
The fix was to do such E4X operationswithin a function that is explicitly called as part of handling some event.. in this case I put it in an mx:Application initialize event handler function.
I just started learning Flex and am still trying to figure out scoping, the order of processing of declarations, compilation etc… Hopefully I’ll understand this better in a few days/weeks.
36. Ultraviolet Design Blog » Flex Builder 3 - Internal Build Error bug | June 24, 2009 at 4:05 am
[...] new bug by any account and from my research seemed to be particularly prominent in Flex Builder 2. This article which lists a few of the reasons which this may happen is very useful and I’ve just noticed [...]
37.
Christian | July 22, 2009 at 7:19 am
I had the wrong path Embeding an image…
btw: using flexbuilder alpha 4 on Linux (could be just me)
38.
ravish | August 3, 2009 at 9:12 pm
In my case a bindable variable created this problem.
[Bindable]
private var ddArrColl:ArrayCollection;
and used somewhere as a dataprovider for a list;
then i changed to
[Bindable]
private var ddArrColl:ArrayCollection = new ArrayCollection();
Bingo..!!!
39.
Scott Schafer | August 13, 2009 at 12:48 pm
Thanks for taking the time to document all this.
I just have to vent and say: what a pathetic excuse for a compiler! So “Internal build error” could mean that somewhere, anywhere, lurks a missing semicolon or some such, and it’s up to the poor human to search every line of the source code for the offending line?
I am seriously ready to give up on Adobe products and just do C# & Silverlight. I don’t care if Flex pays better, this kind of aggravation is just not worth it.
Adobe had better get this right with the next release, or I’m out the door.
40.
Mathias | November 5, 2009 at 3:26 am
Hi,
this post is yet another great example why community works
I had the same issue, walking through the comments I found Brooks Hollar comment and yes, when you concat a String and have linebreaks in your src, this compiler error occurs.
example:
SQLString += “VALUES (” + row.PersonId + “,”
+ row.expenseAllowance + “,”
+ row.probableCustomer;
I’m using Flex Builder 3.0.2.214194 and Flex SDK 3.4.0.9271
on my way to Jira