Tuesday, November 17, 2009

5005: Unknown error optimizing byte code

Recently while working with a large AIR project i ran into this problem. Every now and then all of a sudden, I will start getting this error while compiling the project :
"5005: Unknown error optimizing byte code"

Now as if MS was not enough with their cryptic messages everytime there was a problem with Windows, Adobe also came up with this gem of concept :x .


While googling it, came across this thread 5005: Unknown error optimizing byte code on Negush Blog and even though it did help to some extent but the fact that my project was AIR based and this workaround only worked while testing project. When I tried to publish the project, AIR will throw error about the environment variable set for this workaround.

I was also running into another issue which was that in the Edit=>Preferences=>ActionScript=> Action Script 3 settings tab, I was seeing multiple entries of the './src/" in the "Source Path" section. It seemed that everytime I opened the project, a new entry for this item was being added to that section. As I was in a hurry, instead of looking for the cause et all, I just decided to search for these entries in the registry and found them in the following section

[HKEY_CURRENT_USER\Software\Adobe\Flash 10\ActionsInspector]


While looking at it I also saw a parameter "JVM Max Heap Size" and I wondered if it was same as what was being done by setting that extra environment variable "JAVA_TOOL_OPTIONS" and changed this to "100" (hexa) or "256" (decimal). Removed that environment variable from the system and it has been more than 2 months now and I have not encountered the "5005: Unknown error optimizing byte code" error even once.

As it does involved tinkering with the registry file, please take a backup of the registry section before changing the values so that you can restore if required. Another good thing I found here was that here are stored all the path values for Source Folder, Library, external library, the panel for Adobe has designed as dumb as possible - you can resize it to be bigger, and if you have multiple entries there, scrolling is just pain.. :?.. and I personally found it easier to edit/ update these values in the registry than doing it using the preferences pane.

A typical backup will look like this..

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Adobe\Flash 10\ActionsInspector]
"Package Paths"=".;$(LocalData)/Classes"
"AS3 Package Paths"="./src/;$(AppConfig)/Component Source/ActionScript 3.0/User Interface;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/projects/framework/src;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/projects/rpc/src;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/projects/utilities/src"
"AS3 Library Paths"="C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/libs/flex.swc;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/libs/framework.swc;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/libs/rpc.swc;C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0/frameworks/libs/utilities.swc"
"AS3 External Library Paths"="C:/MyInstalls/Adobe/AIR1.5SDK/frameworks/libs/air/servicemonitor.swc"
"Flex SDK Path"="C:/MyInstalls/Adobe/FlexBuilder3/sdks/3.4.0"
"Classpath State"=dword:00000001
"JVM Max Heap Size"=dword:00000100


In case any of you has found a better solution the Error 5005 or the multiple entries for the src folder.. please do let me know...

No comments:

Post a Comment