Thoughts on supporting Android

Hi guys, I thought I’d start a new thread just so this conversation can be a bit more visible and try to get some opinions and hopefully, a bit of consensus on Android.

I think it’s fair to say that the state of Android in regard to Cinder could be improved. I am in some ways surprised that it’s not farther along, but I think that due to the way that Google has generally handled the NDK over the past few years, it makes sense that Cinder on Android is still considered not supported / experimental.

The last significant work that I can find dates back to around 2015, and a lot has changed with Android since then.

The Android NDK, until quite recently, has never been a particularly pleasant thing to work with, and I say this coming from a good few years experience of working with it. One of the biggest challenges has always been boost support, and this has even led to an entire fork of the NDK itself, However, things are finally beginning to change, for the following reasons.

Android NDK 21 is Google’s first long term support release. This means that it will now be officially supported, and with that comes a lot of improvements, with a focus on modern C++, as well as saying goodbye to a lot of legacy stuff, like Win32 support.
https://android-developers.googleblog.com/2019/10/introducing-ndk-r21-our-first-long-term.html

In addition, the situation for C++ developers on Android, as a platform, and Android Studio’s build system has improved substantially in the past few years.

  1. C++17 is now supported out of the box
  2. Clang is now supported out of the box
  3. Android NDK management is much more straightforward than it was, with full integration into SDK Manager.
  4. Android Studio / gradle support for NDK has improved considerably, with Cmake and gradle now getting along much better

In addition, Android has Vulkan implemented as a native renderer and this is supported quite well.

For these reasons, I think it’s worth taking a fresh look at Cinder on Android - the previous efforts have been so tantalizingly close it seems like a shame not to try to get things working, and a lot of the things which created the need for difficult workarounds have now been resolved.

I can certainly dedicate some time and know-how to this, and it would be great to be able to use Cinder again, especially on Android, where the bulk of my work is these days.

There is a lot of cool stuff that the Cinder community could benefit from on Android, such as ARCore, inexpensive GPU power, and other mobile integrations which have yet to even be considered.

I started looking at the open issues for Android, and the first one is to create documentation for the Android build.

Unfortunately the documentation itself is now so out of date it’s not that straightforward (at least not without a lot of legacy configuration) to get a lot of basic stuff working with the existing build system, so I am working on documenting the migration steps for the sample projects, to get things working with NDK21 and the newer builds of Android. A lot of stuff corresponds to the standard NDK samples, so where it makes sense I’m looking at combining parts of those as well.

When I get this working I will submit a pull request (or possibly a few), and then we can potentially discuss improving the general state of Android in terms of bringing it into like with the other platforms.

I’d really be keen to work with the community on this, and avoid replicating anything that’s been done before. I think that if we work together on this, we can really get Android happening again and start doing some cool realtime coding stuff - there’s a ton of exciting stuff happening now with mobile devices, and it would be great to be able to work with this community to have the creative tools that we all love in Cinder working on Android.

3 Likes

Also - another important point.

Google made a pretty sweeping change last year when they mandated all applications on the Play Store to target API 26 or higher. This effectively ended a lot of legacy support which had been holding back android development in a lot of ways. For Cinder, I would propose that we drop all android legacy support, as it’s not going to be very useful anyway, it will most likely just lead to frustration and wasted time.

API 26 is relatively widespread, and the new NDK build tools do support retaining backward compatibility with the side-by-side NDK installation options. However, given the extremely small Android userbase at the moment I don’t think it really makes sense to retain legacy support for any Android devices below API 26. If anyone desperately needs legacy support, please let me know.

3 Likes

Hi guys. I am now able to devote some time to this. I think it’s important for the community that we get Android support working, as our current build system is pretty outdated.

I’d propose first doing an overhaul of the build environment. I’m developing on Kubuntu, as this is the best Linux distro for Android development on linux - it has all the UI integrations of KDE, coupled with the wider support of Ubuntu, and in my experience is the easiest Linux distro to get up and running.

Generally, if something works on Linux, it will work everywhere else.

My fork is here, if anyone wants to contribute, I’ve be very keen to collaborate.

4 Likes