Using Flash Builder 4 on Ubuntu
So, Adobe has discontinued its Linux version of Flex Builder. That’s sad news for us. Anyway, it doesn’t change much since Linux users already have alternatives long before, e.g. FDT, IDEA. Besides, I have been able to run Flash Builder 4 on my Ubuntu (via Wine) for a while to take advantage of its mxml coding hinting and the unique design view. Let me share some of my experiences of using Flash Builer on Ubuntu so far.
Installation permalink
Some users (here and here) said that they could install Flash Builder 4 (FB4) with Wine. However, that is dated back to the beta version of FB4. I have tried many times with different winetricks to install the released version of FB4 but didn’t succeed. So I have no choice but install it on my Windows virtual machine and copy the installed files to Ubuntu’s wineprefix.
This process is similar to what was described in my previous blog post about making Flash CS5 (and Photoshop CS5) running on Ubuntu, except the winetricks part should be as following:
~$ winetricks msxml3 vcrun2008 usp10 comctl32 ie6
FYI, to my findings, usp10 is for the source editor to work correctly (especially with unicode texts); comctl32 will corrects some win controls and the code hinting popup;and ie6 lets the tooltip display ASdoc help correctly.
(Proof of concept: Flash Builder running on default Ubuntu 10.4 desktop)
Start up permalink
Very often, you will face this error box when starting FB.
Starting it from command line you will find this message:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Don’t worry, try running the application again. You’ll finally have it started (usually after 2 - 3 attempts).
Passing above blocking error, another error message box will appear (all the time, just like with Flash CS5) but just close it and the initialization carry on. You will also notice a long delay before the Splash screen appear.
Code hinting popup issue permalink
When you type, the code hinting popup may appear but doesn’t respond and you cannot input until the popup is closed. It is because Ubuntu’s windows manager is interfering. To resolve, for now, run the wine config (Application > Wine > Configure Wine OR enter this command in terminal: winecfg) > open tab Graphics > uncheck ‘Allow the window manager to control the windows’.
Now the source editor will work as expected. However, there is some downside: the option Allow the window manager to decorate the windows will not be effective anymore. Besides you will not be able to minimize Flash Builder to GNOME panel. It only minimizes to a small icon floating on the desktop. And there appear to be some glitches with text input focus.
Compile and debug permalink
No extra Java Runtime is needed to compile with FB4. The FB4 has a bundled JRE & Flex SDK that will help you check compile-time errors and compile the project as you type.
For the test run, you can install Flash Player activeX debugger for IE6 in Wine to test the application. However, I have discovered a better way: running it directly on your Linux-native browser and still able to debug. How cool is that? Here’s how:
- Open gedit and enter the following text:
#!/bin/sh
firefox -url "`wine winepath -u "$1"`"
What this shell script does is to: open the native Firefox browser with the URL which has been converted from Windows path to Linux path by using ‘wine winepath’ command.
If you prefer Chromium browser, use this command instead:
chromium-browser "`wine winepath -u "$1"`" - Name the file as “lnx_browser” and save it to an easy access folder. (Here I choose /home/username/lnx_browser). Remember to allow it execute as program.
- In FB, navigate to Window > Preferences > General > Web Browser.
- Select “Use external web browser”
- Click New, input new browser settings as following:
Name: Linux Browser
Location: /home/username/lnx_browser (Must be Linux path, do not use Z:\home…)
Parameters: %URL% - OK and then select Linux Browser as your chosen external browser.
After setting up external browser, go ahead and run/debug your application. FB4 will show a warning message about not finding Flash Player. Just ignore and click yes. Your application will run on Firefox Linux!
For testing AIR applications, I just let FB4 use the Windows adl.exe debug loader (no native solution yet). It is fine to test functionality of simple windows. When it uses system tray or something complicated, you can write ANT task of shell script to run the app with native adl.
Isolate FB4 wineprefix permalink
With said configurations and winetricks tweaking, it is very likely that they may affect other installed applications in Wine. I have come across one noticeable case: after setting up for FB4, Photoshop CS5 fails to start due to a conflict with the additional comctl32 library. So, my advice is to isolate FB in a separate wineprefix (default is .wine).
To create a separate wineprefix use this command (assume you want it to be .winefb):
~$ env WINEPREFIX="/home/username/.winefb" winecfg
That command is actually to open wine config window, since wineprefix doesn’t exist, Wine will create a new one in that folder.
After that, prepend env WINEPREFIX="/home/username/.winefb" before every wine command, for example:
- Winetricks:
~$ env WINEPREFIX="/home/username/.winefb" winetricks msxml3 vcrun2008 usp10 comctl32 ie6 - Start wine config:
~$ env WINEPREFIX="/home/username/.winefb" winecfg - Start up FB:
~$ env WINEPREFIX="/home/username/.winefb" wine "C:\Program Files\Adobe\Adobe Flash Builder 4\FlashBuilder.exe"
Summary permalink
Here’s my summary in the style of Wine’s AppDB report for your reference:
What works:
Almost all functions
- Source view
- Design view
- Launching / debugging (with above tweaking)
- Export release builds
- New project/class wizard
- All panels: Package Explorer, Outline, Components, Problems, Console, ASDoc, Network monitor, Properties, Styles…
What does not work:
- Create new folder in New / Import Project wizard
What was not tested:
- Profiler
- Unit testing (but I guess it will work)
- Data/Services
[Vietnamese tag: sử dụng Flash Builder 4 trên Ubuntu, hướng dẫn cài đặt, khắc phục lỗi code hint, biên dịch và debug]