Rebuilding modules for Titanium 6

By | October 22, 2016

I’m no modules expert, nor am I native Android guru. But, when your app depends on eight or ten native modules and Appcelerator announces breaking changes in their SDK, sometimes you have to just dive in and give it your best shot.

Appcelerator has released the beta version of Titanium 6. With it, they’ve updated the V8 engine used on Android. This promises us greater performance and various bug fixes. But, it also means that all native Android modules you use in your app must be updated and recompiled with Ti 6 tooling.

I’ve been going through the modules our app uses. So far, it has been mostly smooth. For those of you facing a similar situation, I thought I’d share my notes of what I found was needed for this process.

Here are the steps I’ve had to take so far:

Update the module’s manifest file:

  • Bump apiversion from 2 to 3.
  • Remove “armeabi” ABI from listing (keep “armeabi-v7a”).
  • Update minsdk to 6.0.0.v20161017194738 (you’ll set this to 6.0.0 once the SDK goes to GA)
  • Bump their module version (typically bump the major number since this is a backwards-incompatible change).

Update the module’s file:

  • titanium.platform must point to the 6.0.0.v20161017194738 TiSDK location (again, use the 6.0.0.GA version once it’s available)
  • make sure the API/Google API levels are set to something like 23
  • you’ll want to use android-ndk-r10e NDK or newer (see my notes below for my build environment)

Code changes

You will need to remove all references to TiContext, as that has been removed from the SDK. So far, the only references I’ve seen have been in overloaded constructors. In those cases, I simply deleted those constructors as well as the import statements.

Depending on the age of the codebase you’re working with, you may also have to update a few import statements. I’ve found these class changes in the modules I’ve updated:

  • org.appcelerator.titanium.util.TiConfig is now org.appcelerator.kroll.common.TiConfig
  • org.appcelerator.titanium.util.Log is now org.appcelerator.kroll.common.Log

You might find it helpful to reference some of the modules that Appcelerator has updated to see the sorts of changes they’ve made. For example:

My build environment

Finally, just for reference, this is my environment. You can probably use other versions of all these components.

  • Ti SDK 6.0.0.v20161017194738
  • Appc CLI 6.0.0-61
  • Node 4.2.4 (newer would probably fine, as this is the min supported version)
  • Android APIs / Google APIs: 23
  • NDK android-ndk-r10e (version r11c should also be compatible, I just haven’t updated yet)

A big thanks to @hans on TiSlack for helping me figure out the above.