Here you will find information on manually installing the SDK and it's environment. This tutorial can take up to an hour or more.
Prepare your system:
Java
- Download the Java JDK
- Install Java
- Verify Java is installed and added to the operating system path
- Open a Terminal window and type java -version. If you see something similar to the following java is added to the path already:
java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
If you receive a message Command not found you may need to add the Java bin directory to the PATH variable
- The path to the Java bin directory is usually one of the following:
/usr/bin/java /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
- To find or verify the path to the Java program you can do a few of the following things:
- You can open Finder and navigate to the one of the common paths listed above and verify the java program is there.
Or, if java is installed and you just want to know the path then you can open a Terminal window and type either of the following two commands:
$ which java $ ls -l `which java`
The first command returns the path to java command. But it does not tell us if this is a symbolic link or actual directory. We use the second command to check if the directory is a symbolic link which then shows the absolute path. The first command returns the following:
/usr/bin/java
The second command returns the absolute path starting with "/System":
lrwxr-xr-x 1 root wheel 74 Oct 25 00:12 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
- To add the Java bin to the operating system path, see the how to add a directory to the operating system path below.
- Open a Terminal window and type java -version. If you see something similar to the following java is added to the path already:
Ant
- Install Ant. Since Ant does not have an install program you may just want to move it to the Applications directory.
- Add the Ant bin directory to the PATH variable. For directions to add the Ant bin to the operating system path, see the how to set the system path section below.
Git
- Download Git
- Install Git
- Confirm the install by opening a Terminal window and typing git.
JUnit
- The Mustella tests require JUnit 3.
Create Directory Structure
Create the following directory structure on your computer for the Flex SDK, usually stored in the root or Documents directory.
/ApacheFlex /ApacheFlex/dependencies /ApacheFlex/source
Download Source
Open a terminal and change the directory to:
/ApacheFlex/source
TIP: You can change to the directory you want automatically by opening a Finder window with the directory you want and then dragging and dropping that directory (folder) onto the Terminal window while also pressing the CMD button. In other words it will run "cd /path/to/the/folder/you/dropped/".Run the following git command to download the Flex SDK source
git clone https://git-wip-us.apache.org/repos/asf/flex-sdk.git flex-sdk
Run the following git command to download the TLF source
git clone https://git-wip-us.apache.org/repos/asf/flex-tlf.git flex-tlf
Change to the flex-sdk directory
/ApacheFlex/source/flex-sdk
Switch to the 'develop' branch (Optional):
git checkout develop
Edit the Environment Properties
For our build scripts to work we need to set the Environment Variables. The environment properties file contains our environment variables which point to the locations of the dependencies we will use throughout the process. These are used by the various build scripts to run and compile the SDK. We will add additional environment variables through out the rest of this tutorial. When we run our build script later the script will validate the paths provided and warn us if they are incorrect.
First, we need to create the environment properties file.
- In the flex-sdk directory create a copy of the env-template.properties file and name it env.properties.
Since we've already installed Java and Ant let's set the path of those. At the end of the env.properties file, set the path to the Java and the Ant directories. For example,
env.JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java env.ANT_HOME=/Applications/Ant/bin
Note: the env template file didn't include detailed instructions for these two variables. So it may be possible to leave them out (since they are in the operating system path?).
Next add the path to the TLF directory (this property is also not mentioned in the env template file so it may be optional as well):
env.TLF_HOME=/ApacheFlex/source/flex-tlf
As we download and add new dependencies you will be instructed when to add the path to the env.properties file.
Add Required Dependencies:
AIR SDK
- Download the Air SDK Flex Edition - Be sure to download the edition specifically made for Flex (currently it's listed below the main download link).
Extract to:
/ApacheFlex/dependencies/AIRSDK/4.0
where the final directory name refers to the version of the AIR SDK you downloaded
Set the AIR_HOME environment variable to the AIR SDK path you chose in the previous step. For example,
env.ANT_HOME=/ApacheFlex/dependencies/AIRSDK/4.0
Adobe Flash Player Projector
- Download the Flash Player Projector (plugin content debugger, projector content debugger or projector?)
- The plugin content debugger comes with an installer. The Projector Content Debugger install program does not install into anywhere (for me at least). Once you run the installer you must copy it to the location you want. In this case, copy it to the /ApacheFlex/dependencies/player directory.
Note: on OSX, append '.app/Contents/MacOS/Flash Player Debugger' to the path to the Flash Player.
/ApacheFlex/dependencies/player/Flash Player.app/Contents/MacOS/Flash Player Debugger
Set the FLASHPLAYER_DEBUGGER environment variable to the installation path of the projector.
env.FLASHPLAYER_DEBUGGER=/ApacheFlex/dependencies/player/Flash Player.app/Contents/MacOS/Flash Player Debugger
You may also be able to use the Flash Player Plug-in. It is usually located here,
/Library/Internet Plug-ins/Flash Player/
The full path would be:
/Library/Internet Plug-ins/Flash Player.app/Contents/MacOS/Flash Player Debugger
Adobe Flash Player playerglobal.swc
- Download playerglobal.swc - This is on the same page as the content debugger you just downloaded.
Copy it to:
/ApacheFlex/dependencies/PlayerGlobal/player/12.0
where the number corresponds to the version you download.
- Rename copied file to 'playerglobal.swc'
Set the PLAYERGLOBAL_HOME environment variable to
env.PLAYERGLOBAL_HOME=/ApacheFlex/Dependencies/PlayerGlobal/player
Adobe Pixel Bender Toolkit
- Install Pixel Bender. When you install the program it gives you the option to choose the install location. Copy this location before you install.
Set the PIXELBENDER_HOME environment variable to the installation directory.
For me the install was here,
env.PIXELBENDER_HOME=/Applications/Utilities/Adobe Utilities-CS5.localized/Pixel Bender Toolkit 2
Adobe Extension Manager
(Optional) The Adobe Extension Manager is only required for those creating releases or testing changes to the flash-integration swc. Note that if you change APIs on classes that flash-integration depends on, you may need to update flash-integration.
- Download the Adobe Extension Manager
- Linux - On Linux, no Adobe Extension Manager exists and you do not set the environment variable.
- Linux - On Linux, no Adobe Extension Manager exists and you do not set the environment variable.
Run the installer
On Windows, set ADOBE_EXTENSION_MANAGER to the absolute path of "Adobe Extension Manager CS5.exe"
On Mac, set ADOBE_EXTENSION_MANAGER to the absolute path of "Adobe Extension Manager CS5.app".
For me, the path is:env.ADOBE_EXTENSION_MANAGER=/Applications/Adobe Extension Manager CS5/Adobe Extension Manager CS5.app/Contents/MacOS/Adobe Extension Manager CS5
Prepare System
For testing, the Adobe Flash Player's mm.cfg file must have the proper properties set and a FlashPlayerTrust file must allow local SWFs to access local files.
Open the mm.cfg file in an editor. The location of the mm.cfg file depends on your operating system. See this page. On OSX the file is found in this directory:
/Library/Application Support/Macromedia
If it doesn't exist, manually launch the Adobe Flash Player Projector content debugger and it should create the mm.cfg at that time. You can also create the file manually. More info.
Add or verify that the following entries are in the file:
ErrorReportingEnable=1 TraceOutputFileEnable=1
- In the same directory as the mm.cfg file is the FlashPlayerTrust directory.
- Open that directory and create a new text file called ApacheFlex.cfg.
In that file add the parent directory of Apache Flex SDK. For example:
#Path to Apache Flex Source /ApacheFlex/source
- Save the file.
Set the Build Properties
- In the flex-sdk directory is the build properties file. This contains the version numbers of the software you downloaded.
Open this file and set the following values to the version of the Flash Player and AIR SDK you are using:
# Flash player version for which player global swc to use playerglobal.version = 12.0 # AIR version number air.version = 4.0
These values are used in building the path to the SDK. So if you saved the playerglobal.swc to the following directory:
/ApacheFlex/dependencies/PlayerGlobal/player/12.0
the value of the playerglobal.version would be 12.0.
Note: Since this value builds the path be sure to use the full value, 12.0, instead of 12 if your path contains it.
Note: If you are using a new version of the Flash Player that is not yet mentioned in the version of the Flex SDK you are working with you may get the message:Error: configuration variable 'swf-version' value contains unknown token 'playerglobal.swfversion'
You'll need to update the /ApacheFlex/source/flex-sdk/frameworks/build.xml file with an updated version check code. More information is listed below in the Errors section.
Build the SDK
Now we should be ready to build the SDK. This does not build everything since there are many aspects to the source code. For example, if you want to use the Flex SDK with an IDE like Flash Builder you will have to run another build target mentioned later in this tutorial. For now we will use "ant main" to build the the majority of the SDK.
Open a terminal and change to
/ApacheFlex/source/flex-sdk
Before we build the SDK we should validate the environment paths we've setup.
Validate the environment variable paths we've setup earlier are correct:
ant check-compile-env
This will check each of the paths we've set and warn us if any of the locations are incorrect. An example of the results are below:
check-playerglobal-home: [echo] PLAYERGLOBAL_HOME is /ApacheFlex/Dependencies/PlayerGlobal/player [echo] playerglobal.version is 12.0 [echo] playerglobal.swc is /ApacheFlex/Dependencies/PlayerGlobal/player/12.0/playerglobal.swc check-air-home: [echo] AIR_HOME is /ApacheFlex/dependencies/AIR/AIRSDK4.0 check-tlf-home: [echo] TLF_HOME is /ApacheFlex/source/flex-tlf check-compile-env: [echo] OS: Mac OS X / 10.9.2 / x86_64 [echo] VM: Java HotSpot(TM) 64-Bit Server VM / 25.0-b70 [echo] Java: 1.8.0 [echo] Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 Ant Java Version: 1.8
If we received no errors we can continue. Currently the check for TLF may return a blank line. Hopefully this code will be fixed in the next release.
If we received errors then we need to check the paths we've supplied in the env.properties file against what is installed on the file system. Use Finder or Explorer to verify the files and paths are correct.
When we are ready, start the build by calling ant main:
ant main
Once the build starts running it can take up to 20 minutes the first time. As it runs there will be times when you need to accept the license agreement.
- Click Y to accept the license agreements as they appear.
- If you encounter errors please see the Errors section at the bottom of this page or add comments or send messages to the mailing list if errors do not help.
Prepare for IDE
To use Flex SDK in Flash Builder you need to compile the SDK to a new directory? But before we can do that we need to build the RSLs.
Change directories to:
/ApacheFlex/source/flex-sdk
Run the following command:
ant frameworks-rsls
This will compile the framework RSLs necessary to build the SDK for an IDE.Change directories to:
/ApacheFlex/source/flex-sdk/ide/flashbuilder
Run the following command:
sh makeApacheFlexForIDE.sh /Applications/Adobe Flash Builder 4.7/sdks/Flex_4.12
where the directory name is the name of the Flex SDK directory that you will set up in your IDE. I would recommend that you don't choose any sub directories of the git repository. This will slow down git clients as it adds another 50k files to track and in addition, these should not be checked into the repository.
Add the SDK to your IDE
Once complied you can add the SDK to your IDE of choice.
That's all. It should all work perfectly. No refunds.
To Add a Directory to the Operating System Path
To add a directory to the operating system path follow these instructions below (or video).
These steps relate to OSX (10.9.2):
• Open up Terminal.
• Run the following command: sudo nano /etc/paths
• Enter your password when prompted.
• Go to the bottom of the file and enter the path you wish to add.
• Hit Control-X to quit.
• Enter 'Y' to save the modified buffer.
• Hit enter again to confirm that you want to write to the file, "/etc/paths". This will return you back to the terminal.
• To verify the path was written restart nano as in the first step and view the contents or restart Terminal and type:
echo $PATH
You should see the new path appended to the end of the PATH
Troubleshooting
Check all environment variables set
You should have a set of variables like this:
export AIR_HOME=/home/tchiverton/workspace/apache-flex-4.12/apache-flex-sdk-4.12.0-bin/ export FLASHPLAYER_DEBUGGER=/home/tchiverton/bin/flashplayerdebugger #for mustella/mini_run.sh export ANT_HOME=/usr/share/ant #for main build export PLAYERGLOBAL_HOME=/home/tchiverton/workspace/apache-flex-4.12/apache-flex-sdk-4.12.0-bin/frameworks/libs/player/ export TLF_HOME=/home/tchiverton/workspace/flex-tlf
Error
Error: configuration variable 'swf-version' value contains unknown token 'playerglobal.swfversion'
You may be using a newer version of a Flash Player than is defined in the build scripts.
- Following the path structure we've set up earlier in this tutorial go into the /ApacheFlex/source/flex-sdk/frameworks/build.xml file and search for playerglobal-setswfversion
Following the code pattern in the build target, add a check for the version of the Flash Player you are using. For example, if you wanted to add support up to FP 14 and 15 you would add the following code:
<condition property="playerglobal.swfversion" value="23"> <equals arg1="${playerglobal.version}" arg2="12.0" /> </condition> <condition property="playerglobal.swfversion" value="24"> <equals arg1="${playerglobal.version}" arg2="13.0" /> </condition> <condition property="playerglobal.swfversion" value="25"> <equals arg1="${playerglobal.version}" arg2="14.0" /> </condition> <condition property="playerglobal.swfversion" value="26"> <equals arg1="${playerglobal.version}" arg2="15.0" /> </condition>
Error
You must build the RSLs for this SDK first. See the README at the root.
You must build the frameworks before making the project ready for the IDE.
- Change directories to the /ApacheFlex/flex-sdk folder
- Run ant frameworks-rsls
You should see the RSLs in the /ApacheFlex/FlexSDK_IDE_READY_4_12/frameworks/rsls.
Error
unable to open '/ApacheFlex/source/FlexSDK_IDE/frameworks/libs/player/12.0/playerglobal.swc'
You must copy the playerglobal.swc to the built Flex SDK "libs/player/12.0" directory. For some reason it didn't get copied out. This should be in your ApacheFlex/dependencies/PlayerGlobal/' directory.