This is a set of project files to make it possible to use OpenFrameworks with Android Studio.
- Install and configure Android Studio
- Install the Android NDK somewhere
- Download and unpack OpenFrameworks
- Copy the files from this repository over top of the OpenFrameworks files, merging directories (i.e. replace existing files, but do not replace entire directories)
- Open this directory as a project in Android Studio (use File->Open and select this directory)
- Set
ndk.dirin thelocal.propertiesto the full path to your Android NDK - Build and run the example app
To create new projects:
- Copy the provided example app (make sure to put it in a subdirectory of
apps, at the same level as the sample) - Double-click on
build.gradleand press "Add Now..." - If that doesn't work, add the project to
settings.gradlemanually. - Perform a project sync (it should prompt you to do this).
To create projects from existing examples:
- Copy the
build.gradlefile fromandroidEmptyExampleinto the examples directory. - Follow steps 2-4 above.
-
You may need to adjust the following numbers to match your installed Android Studio and Android SDK. Android Studio should offer to fix these values for you when you open the appropriate build files.
- The Gradle version specified in
/build.gradle - The
compileSdkVersion,buildToolsVersion,minSdkVersion,targetSdkVersionvalues in/addons/ofxAndroid/ofAndroidLib/build.gradleand/apps/myApps/androidEmptyExample/build.gradle
- The Gradle version specified in
-
If you get strange linker errors (e.g. errors about a missing
__srget), try using the r9d version of the NDK. Newer NDKs (particularly r10c and up) don't work with some versions of OpenFrameworks. -
Getting a manifest merge error involving
ic_launcher? Try replacingaddons/ofxAndroid/ofAndroidLib/AndroidManifest.xmlwith the one from this repository, or just deleting the<application>tag from that file.