Cinder for Android

chaoticbob edited this page Dec 1, 2015 · 1 revision

Requirements for Cinder for Android

JDK 1.7 or Later

Download JDK 1.8 Here
Download JDK 1.7 Here
Cinder for Android requires JDK 1.7 or later. If you're on MacOS X, it will not work with the JDK (1.6) that ships with MacOS X.

Android Studio

Get the latest Android Studio here.

Samples and projects have been tested with Android Studio 1.3. Android Studio 1.3 is still fairly new, if you run into any problems with it, please post an issue.

Android Studio 1.3 may throw a NDK plugin incompatibility warning. For the time being, this can be ignored - Cinder for Android does not fully use Android Studio's internal NDK toolchain.

NDK

Get the latest NDK here.

Cinder for Android works with NDK r10d or later. The build system is configured to look for the NDK in a directory called android-ndk that sits next to the Cinder directory. For example:

.../android-ndk
.../your_cinder_dir

Alternatively, you can set the default the NDK location by having Android Studio download the NDK. Android Studio will download the latest NDK, so make sure that your Cinder build also lines up with this.

To have Android Studio download the latest NDK, select File->Other Settings->Default Project Structure. The text field for Android NDK Location should be empty. Underneath the text field will be a Download link to click on. This will launch the automatic downloader. Once downloaded, it should resemble:

Android SDKs

Cinder for Android only works with Android 4.4 and later, this means API Level 19 or later. While it's recommended for users to install SDKs for 4.4 through 5.x - they can be installed on an as needed basis.

CMake

Cinder for Android requires CMake 3.1 or later. You can use the binary package or do a build from the source. Make sure cmake is in $PATH and accessible from the command line.

You can find the downloads for CMake here.

Building Cinder for Android

Building on MacOS X Host

Pre-build checklist:

  • XCode is installed (or the command line tools, we require make).
  • Boost submodule for Cinder is installed.
  • NDK is installed.
  • CMake 3.1 (or later) is installed and cmake is accessible from the command line.

Lets build Cinder for ARMv7 (most common architecture for Android devices). Starting in the Cinder directory:

cd android
./fullbuild-armeabi-v7a

This will build libcinder.a and libcinder_d.a for API Level 19 (KitKat) and API Level 21 (Lollipop).

Building on Linux Host

Pre-build checklist:

  • binutils is installed (we require make).
  • Boost submodule for Cinder is installed.
  • NDK is installed.
  • CMake 3.1 (or later) is installed and cmake is accessible from the command line.

Lets build Cinder for ARMv7 (most common architecture for Android devices). Starting in the Cinder directory:

cd android
./fullbuild-armeabi-v7a

This will build libcinder.a and libcinder_d.a for API Level 19 (KitKat) and API Level 21 (Lollipop).

Building on Windows Host

...coming soon.

Building and Running BasicApp

Before continuing, Cinder based applications should run on a physical device and not the emulator. Currently, there are no plans to support Cinder apps launching from the emulator. The emulators only support OpenGL ES 2 currently, Cinder for Android defaults to OpenGL ES 3 with Open GL ES 2 as an opt-in.

Pre-Build Check

If you opted not to have Android Studio download the NDK for you and wish to use the NDK placed parallel to your Cinder directory, select File->Project Structure. Set the value of Android NDK Location, by typing or browsing. It should resemble:

Building and Running

  1. Opening the BasicApp project
  2. Which starting point? 1. If you're starting from the Android Studio dialog that has the Quick Start section, click on Open an existing Android Studio project. 1. If you're starting from File menu, select File->Open
  3. This next step is very specific. It is very easy to select the wrong project in Android Studio if you're new to it. 1. Browse to your_cinder_dir/samples/BasicApp/androidstudio 1. Select the BasicApp folder that is inside androidstudio and click Choose (OK on Linux).
    1. The reason for this is because Android Studio uses the last most directory for its window title. If you have multiple projects open, having androidstudio as the window titles makes it annoying.
  4. Once BasicApp is opened, select Build->Make Project
  5. When the build is complete, select Run->Debug app
  6. Dialog should pop up asking which device to use.
  7. Reminder: You should use a physical device rather than the emulator.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.