Setting up OpenFrameworks/Android to work with RTcmix
What follows are directions for setting up an OpenFrameworks/Android
environment for developing Android apps using
I am certain that some of the APIs, etc. are
probably out-of-date, but I became really
frustrated trying to coordinate the Android/Eclipse/OpenFrameworks
intersection, and I believe this should probably work. In about a year
or so it probably won't. Oh joy. By the way, I am writing this in December,
2014 in case it matters.
This will use the latest (0.8.4 as of this doc) OpenFrameworks package
for Android, but the Eclipse project and Android SDKs are older.
But when updates (with newly-annoying 'cutesy' names and insane
numbering schemes) get pushed out every few months or so, not
that much older. In any case, this should build applications
that will run on most extant Android devices.
At this point, you can unpack and
try the "BasicRTcmix" project. I like to put it in
the same directory as the "androidEmptyExample"
("RTcmix-android/of_v0.8.4_android_release/apps/myApps"), but you can
really put it wherever you'd like. The procedure is the same as
for the "androidEmptyExample" project -- go to File -> Import and
take it from there.
First of all, you need to download the packages to set
everything up. I got so fed-up with trying to configure the Eclipse
project and Android SDKs from the current websites that I just built
my own. You can download them from here:
I also created a basic ofRTcmix project you can use for testing and
seeing how RTcmix scripts can be incorporated into an OF app:
In addition to these, you will need the following two packages:
- Now we set things up. First,
create a directory (we'll say "RTcmix-android" for this doc) and unpack all
but the "basicRTcmix.zip" file into it. The direcory should look like
- Go (in a Terminal window or from the Finder) to the directory:
and copy the file "paths.default.make" to "paths.make"
- Edit that "paths.make" file:
and change the "NDK_ROOT" and SDK_ROOT" to point to the directories:
# Default paths.make file.
# Enter the correct paths for your system and save this file as paths.make
NOTE: use full pathnames -- yours will obviously be different, depending on
where you put the "RTcmix-android" directory on your computer
- Go to the "RTcmix-android/brads-eclipse" directory
and double-click on the "Eclipse.app" to start up Eclipse.
- It will ask you to select a workspace. You can put this wherever you want.
To keep things 'contained', I just point mine to the "RTcmix-android"
directory I created
(use "browse" and select the "RTcmix-android" dir and hit "Open")
If this is the first time you have used Eclipse, it will ask you to set up the
location of your android SDK:
Click "Open Preferences". Google will then
ask if you want to send them 'usage stats'. That's up to you....
- Eclipse will ask for the location of your SDK directory:
the "RTcmix-android/brads-android-sdk-macosx/" directory and click on
"Apply". You should see this:
then click "OK"
- After closing this window, you may see this window:
This is now redundant. You can hit "Cancel".
Do not "Install the latest available version of Android APIs"
or "Install Android 2.2"!
NOTE: if you have already run Eclipse before,
you may get a notice that the "Location of the Android SDK has not been
Choose "Open Preferences" and browse to "RTcmix-android/brads-android-sdk-macosx".
Hit "Apply" and then "OK".
If you have already been using an Android SDK, you may need to reset
it to point to the one I am using for OF development
(i.e. RTcmix-android/brads-android-sdk-macosx"). That's done
by going to Eclipse -> Preferences and resetting
the "Android" entry as described just above.
This may mess up your other Android development. If you've
already been using Eclipse/Android, then you probably know more than
I do about how to configure all this stuff. Send me useful tips if
you know them!
- Now you should see the Eclipse "Welcome" screen:
Close it with the
"X" next to the "Welcome" in the upper-left, and you should see this screen:
- Now go to Eclipse -> Preferences (the menu at the top left of your screen,
under "Eclipse") and select "C/C++" and then select "Code Analysis":
- Scroll down to where it says "Syntax and Semantic Errors" (there will
be a bunch of little red "x" marks under "Severity" in the window). Un-check
the box next to "Syntax and Semantic Errors". The window should go from this:
hit "Apply" and then "OK".
NOTE: When I upgraded to Yosemite (OSX 10.10.1) on my MacBook Pro,
the "indexer" used by OF to assist in code searchers, etc. broke
because of memory-usage problems. I have 8 Bytes of RAM in my
MacBook, but it still crashed and burned. You can turn off the 'indexer'
by going to the "C/C++" preferences as above (and select "Indexer"):
and unchecking the "Automatically update the index" (under "Indexing
This seems to cause no big problems, except for possibly inhibiting
code-searches you may want to do. If you really need to get the
indexer running, there seems to be several memory-management settings
you can try in Eclipse. Have fun!
- You should be back to the main "Eclipse" project screen. Now go to
File -> Import and open the "General" submenu and select "Existing
Projects into Workspace":
- Hit "Next >" and browse the "Select root directory" to
- Do the same thing and select
"RTcmix-android/of_v0.8.4_android_release/libs/openFrameworks". Your Eclipse
workspace should now look like this:
- Now do the same File -> Import for
When it imports, a red exclamation-mark will probably appear next to the
imported ofAndroidLib. Select that ofAndroidLib entry and go to
File -> Properties:
- This will bring up this window:
Select "Android" from the menu at the left, and the following window
click the check-box next to "Android 4.2.2" (I think "Android 4.3" will also
work) and hit "Apply".
- At the bottom right of the Eclipse Project window, it will say something
about "loading Android data". When that is finished (it may say
"Android SDK Content Loader" at that point), then hit "OK".
- The red exclamation-mark should change to a red "x" next to the ofAndroidLib
- At this point, I would suggest quitting and restarting Eclipse. Use the
workspace you set up at the start of all this (it should appear as the
default). When Eclipse restarts, it will crunch through some stuff and
the red "x" next to the ofAndroidLib entry should change to a benign
yellow triangle-warning thing:
- Now go to File -> Import and set the root directory to
and hit "Finish":
This will trigger a compilation of the main OpenFrameworks lib. You will
see the progress in the "Console" window below:
You may also get the same red exclamation-point appearing next to the imported
project. After the library update completes (it will take awhile -- you should
see "Build Finished" appear in the "Console" window), then
(as you did with the ofAndroidLib), select the "androidEmptyExample"
project and go to
File -> Properties to set the Android property to "Android 4.2.2"
(or "Android 4.3"):
Hit "Apply" and then hit "OK".
After a short compile, the red exclamation mark should go away.
- At this point, you can probably connect and Android device and
compile/run the "androidEmptyExample" on it. I generally restart
Eclipse one more time before doing this. NOTE: I have not
run this using the Android simulator. I read that it was a bit
buggy, so I chose to do all my development and testing directly
upon my Android device (A Kindle Fire HD). I don't think that it
is much slower than starting the Android simulator, plus you are
guaranteed that it works on a device.
- When Eclipse restarts, it will run through a quick compile/check of
all open projects. You can turn this off by de-selecting the "Build
Automatically" entry under the "Project" menu (see the note above about
turning off the 'automatic indexing' of C/C++ code).
- To run the "androidEmptyExample", select the "androidEmptyExample"
in the menu, connect an Android device and then hit
the green arrow ("Run") at the top of the Eclipse project menu.
Run it as an "Android Application", of course.
- It will take awhile, but your device should show up under the "Device
Chooser" window that appears:
select it and hit "OK".
NOTE: you may have to plug and re-plug your device
into your computer's USB port several times. Eclipse seems a little
persnickity sometimes about recognizing devices. Occasionally I get
a blank "Device Chooser" display but I can still hit "OK" and it
- I suggest monitoring the "LogCat" output (a window may appear asking
you if you want to do this).
- The "androidEmptyExample" should run on your device.
The first time you load "BasicRTcmix", it will do a long compile
of all of RTcmix. Once you start working it will
usually only do incremental compiles (i.e. not so time-consuming)
on the files you change, unless you clean the project and do
a complete recompile.
Also, I don't think the little red exclamation-mark will appear
with "BasicRTcmix". It may appear if you import the other android
examples that come with the OpenFrameworks distro. Do the
same procedure to set the "Android 4.2.2" or "Android 4.3" as
you did with the "androidEmptyExample" and the ofAndroidLib.
NOTE: the basic files to modfy for fun RTcmix-ing are
in the "src" menu of the main "BasicRTcmix" menu:
Good luck with this! -- brad