Tutorial: How to setup openFrameworks for Android on Windows


As a windows user I was wondering why the download page and the install guide (http://www.openframeworks.cc/setup/android-eclipse) noted that openFrameworks for Android was only supported on the Linux and Mac OS X platform.

Today I spend some time figuring out how to make the code compile under windows. Basically I had to install a MinGW/MSYS environment and fix some makefiles to get it working. To hopefully help out other users of OF, I wrote a tutorial on how to patch the source and build it on windows :).

The complete tutorial can be found here:

Feel free to import the fixes into github ;)!

  • Falc.

*updated the tutorial a bit.

  • It was missing a few slashes in the path before, and the part where you need to set the run config is now:
    AndroidInstall PROJECT_PATH=/c/temp/OF/apps/androidExamples/${project_name}

It needs to be a linux shaped path instead of C:\temp\OF…

  • And you need to add the JDK bin directory to the PATH environment variable

Really awesome! Can’t wait to try it. I’ll report back how it works.

Thanks for the great contribution. :slight_smile:

hey thanks for that!

I’ve created a zip package with the updated Makefiles. OF-windows-Makefiles.zip.

To install, just unzip the package to wherever you’ve placed OF. For example if its C:\temp\OF… you should unzip it to C:\temp\ . Just overwrite all existing Makefiles and adjust paths.make if you need.

Awesome! It works it works! :smiley:

The the downside is that nothing runs correctly in the emulator. But that seems to be a cross-platform issue (not windows specific).

have added a link to your blog in the setup instructions page. thanks!

Hi, thanks for the tutorial on setting up OF + Android + Windows.

I ran through the setup and have not been able to get any of the example apps working on either the emulator or real devices (as Seth suggested).

Have you managed to have success at getting the apps to run?


The apps should run on the device I believe, but not in the emulator. Are you receiving any errors? What happens when you install on the device?

The error I get on my Nexus One (2.3.4)


The application androidPolygonExample (process cc.openframeworks.androidPolygonExample) has stopped unexpectedly. Please try again.

I will go over the build process again from the tutorial and see whether I can get around this somehow, otherwise I might just resort to linux. It would be great if the emulator worked as well!

Looks like the problem was that I had spaces in my Android NDK and SDK paths. Probably should have picked up on this from the multiple locations it was written. Apparently the work around PROGRA~2 does not work!

Both the device and emulation modes work now.

Glad you got it fixed. Are you getting openGL to draw correctly in the emulator? I still haven’t been able to.

Just doubled checked to see whether OpenGL was displaying correctly and now none of the emulator examples seem to work.

From memory the OpenGL in the examples was working yesterday so I don’t know how and where things went wrong.

I don’t think I will use the emulator though due to the agonizing slowness at which it uploads the apps. Its still kinda slow on a real device but many times worse in the emulator.

For those who upgraded to SDK r14, you will need to run “android update project” on the ofAndroidLib project. Otherwise the examples will fail to build. I’ve updated the EmptyExample and ofAndroidLib in my branch on GitHub: https://github.com/falcon4ever/openFrameworks I’ll be updating the other examples soon.

But with earlier versins there aer no such problem, right?

Yea if you’re running with SDK r12 you should be fine. It’s not a big deal to upgrade to r14 though, you can either run the android update project on the ofAndroidLib yourself or just do a checkout of the version i placed on github (be sure to select the development branch).

I’ve uploaded a small fix for NDK r7: https://github.com/falcon4ever/openFrameworks/commit/691021f3bc88d5263717b3a38af24da8cbe56e72

Basically you will need to add this to your CFLAGS or it will give some errors like “glDeleteFramebuffersOES’ was not declared in this scope”

I’m getting it to build fine but I can’t seem to get it to run. It crashes with the following ClassNotFound exception, on both emulator and device:

12-09 16:10:42.339: E/AndroidRuntime(1867): Caused by: java.lang.ClassNotFoundException: cc.openframeworks.androidTouchExample.OFActivity in loader dalvik.system.PathClassLoader[/mnt/asec/cc.openframeworks.androidTouchExample-1/pkg.apk]
12-09 16:10:42.339: E/AndroidRuntime(1867): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-09 16:10:42.339: E/AndroidRuntime(1867): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-09 16:10:42.339: E/AndroidRuntime(1867): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-09 16:10:42.339: E/AndroidRuntime(1867): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-09 16:10:42.339: E/AndroidRuntime(1867): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
12-09 16:10:42.339: E/AndroidRuntime(1867): … 11 more

I’m using NDK r7.
the falcon4ever openframeworks branch.
Java SE 6 Update 29
I tried the nokia mingw and had a similar crash, but this is built from a fresh install (fresh installed everything and tried again) the official MinGW from sourceforge.
I had the pkg-config bug but I fixed it with mingw wiki faq.

Any help would be appreciated. And the time you’ve already put into putting together such a comprehensive tutorial.


Did you changed the project name or namespace of the project? Or is this just a checkout from the repo without any modifications?

The only thing I edited was the paths.make file since I already have the sdk/ndk installed in different paths. But I did verify that the changes in your guide where made in the branch. I really don’t know what to try I’ve tried redownloading all the major components twice now with different version of mingw and java. I don’t know what else to try.

I’m not sure whats going on, but I don’t think its related to the compiler.
On my system I’m using Java 1.6 build 26 (FYI JDK 7 doesnt work too well)

Could you check this folder: “OF\libs\openFrameworksCompiled\lib\android”

If you have the following files, it means that your compiler (MinGW) is set up properly.

The only thing I can think of is that perhaps some project setting of eclipse is messed up or perhaps the path in one of the Makefiles.