KMP = Efficiency

 

Innovative engineering orgs are always looking for ways to be more efficient.

 

GoPro is no different. 

Key engineers on the mobile team were interested in Kotlin Multiplatform (KMP) for code sharing and migrating legacy C++ code to Kotlin. Music to our ears! 

Software architect Matt Jordan described the rising importance of multiplatform at GoPro and why he’s all-in with KMP:

“For the industry at large, I think cross-platform is inevitable.

When mobile adoption was growing rapidly you didn’t have to worry about engineering efficiency. With that plateauing, the industry is focusing more on efficiency. We care about it here and it’s a priority for leadership.

React Native, Flutter and KMP are the only multiplatform choices.

React Native feels like they focus on sharing UI rather than sharing under-the-hood.

I’d use Flutter as an individual and run until I faced a limitation with it, which depending on the app I was working on, I may or may not encounter. Flutter becomes a harder choice for established products and when working with other people. For instance, getting the iOS team onboard would be a tough sell. Flutter’s weakness is KMP’s greatest strength: integration with platform native code. In an established app, you have lots of existing native code to integrate with, so that’s a critical ding to Flutter. Also some kinds of app will likely always need those “escape hatches” to go to native solutions (anything using BLE for example), and for those apps, even if they’re new, Flutter might not be the best option.

By contrast, KMP’s solution for integrating small platform-specific pieces of logic seems the smoothest (of the multiplatform options) by far. I totally agree with KMP’s strategy of not caring about UI but sharing everything underneath the hood.

So…process of elimination, all my eggs need to be in the KMP basket in order to have a happy future.”

Matthew Jordan

Software Architect, GoPro

GoPro x Touchlab – a perfect Kotlin Multiplatform pairing!

 

Sharing is Caring! (Getting Started is Hard)

While GoPro had a reasonable idea of what they wanted to target with KMP, when they attempted on their own, configs didn’t build and online tutorials were not helpful.  

Sadly enough, KMP was put back on the shelf two times before they partnered with us on a guided evaluation of Kotlin Multiplatform. 

GoPro isn’t alone; we developed guided evaluations of KMP with organizations like them in mind. 

From our experience, we’ve found that project configuration is the confusing bit for many teams. Teams also wonder how to actually “share” code? Submodules? Relative path? Single repo? 

This is all new to a lot of people and there isn’t always documentation to answer these foundational getting started questions. 

Matt elaborated on some of GoPro’s frustrations with getting started with KMP, “Gradle has the most conflicting info online and even when you get the right info, you still run into things.”

Partner with Touchlab

powered by Typeform

Our Time Together

During our prep work, we asked GoPro what they wanted to accomplish during their guided evaluation of Kotlin Multiplatform. Matt and fellow architect Alexander Collins shared a great list: 

  1. Build a KMP POC for shared code across Android and iOS 
  2. Integrate POC C++ library into a KMP module
  3. Better understand KMP deployment and workflow  

We set a goal to help GoPro have the KMP component run on Android and iOS and put them in a position to say yes, no, or not right now to integrating KMP at their organization. 

Here’s a recap of how the week went: 

  • Basic Setup: During the first day, we sorted out gradle issues for basic code sharing setup, nothing with C++ yet. We also encountered an iOS API gradle issue that took time to sort. By the end of day 1, we helped GoPro get past their gradle issues and move further down the KMP path than in their previous efforts. 
  • App Size: GoPro had questions about app size increase. They discovered, “Ok, a release build of the app with Kotlin makes a difference of ~1MB, so that’s awesome.” 
  • Rest of the week: After the build was running, we focused on practical team stuff. We also spent time covering concurrency. We wrapped the week with discussions on selling KMP to the team and management. 

Mission Accomplished

In our postmortem for the guided evaluation, we asked GoPro if they were happy with the way the week played out. 

Matt said, “Overall, yes. Major goal was to see how palatable it is from an iOS perspective.”

Alexander added, “Mission accomplished. Find out if possible, and if possible how nice is it to work with. Solid conclusion: pitfalls but identified them.” 

A sincere thank you to our friends at GoPro for their participation! We too learned a lot and are in a better position to drive KMP adoption after our time together. Win win!

    Driving KMP Adoption

    We understood from early on that we can’t just tell people how awesome Kotlin Multiplatform is. We have to show them! 

    We developed KMP guided evaluations and our starter project, KaMP Kit to put the ability to deliver on Android AND iOS with KMP in the hands of developers with as little complexity and wasted energy as possible. 

    Our hope is that after developers get the KMP app to run they’ll have a better sense of what a possible KMP implementation on their production systems would look like.

    If your team is exploring a multiplatform or cross-platform mobile development framework, here are some of our available resources: