Getting started with openFrameworks on Android

Part 1: General setup you’ll only have to do once

$ git clone --recursive https://github.com/openframeworks/openFrameworks.git
Run these commands from the Terminal.
$ cd openFrameworks/
$ ./scripts/android/download_libs.sh
Run these commands from the Terminal

Note: if you get a “wget command not found”, it means you’re missing the wget program. I recommend you install Brew and then use it to install wget using brew install wget.

In the end, my OF folder looks like this
A warning you’ll get the first time you open the Project Generator

Part 2: Compile an example Android application

The “androidPolygonExample” app we’ll build and deploy
Al the android examples that come with openFrameworks
Your version will say NDK r15c.
Click on the “Project Structure” button in the toolbar
Notice the new path for the Android NDK location. Your version should point to NDK r15c.

Note: as an aside, these two buttons on the bottom right of Android Studio are useful for checking errors and logs.

Two panels that will prove useful as you code and debug.
Click on “Project” on the left hand toolbar first. Then use the dropdown to navigate to Project.
Two ways to build the project.
$ adb devices
Two ways to run the app.
The androidPolygonExample app.

Note: The ins and outs of Android Studio are also outside of the scope of this tutorial. But if you’d like to understand how the build process works and what Gradle is read: https://developer.android.com/studio/build/index.html

ofSetupOpenGL(1024,768, OF_WINDOW); // Don't be fooled, this won't solve anything
appIphoneScale = 0.5; // Just ignore that it says iPhone :)
appIphoneScale = 1.5; // Works on my Pixel in landscape mode
A scaled-up version
$ adb shell 'pm list packages -f openframeworks'
In my case, I have several openFrameworks apps installed. The androidPolygonExample is highlighted above.
$ adb logcat *:E
ofLogNotice("testApp.cpp") << "I'm outputting a test message";
$ adb -d logcat testApp.cpp:I *:S

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store