BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Using Clojure to Build Native Android Apps

| by Sergio De Simone Follow 5 Followers on Aug 26, 2015. Estimated reading time: 1 minute |

Clojure development on the Android platform has been progressing remarkably in the last few years, allowing developers to use it in fully fledged apps such as SwiftKey’s Clarity Keyboard. Here we will review the current status of tools that support Clojure on the Android platform.

Historically, Clojure on Android has suffered from slow startup, which could last up to 4–10 times longer than Java’s when using standard upstream Clojure. This issue is addressed by Skummet, a Clojure fork that optimizes Clojure’s compiler so that it produces more compact, faster-to-load bytecode. Besides providing an optimizing compiler, Skummet also includes an optimized version of Clojure’s runtime that is built by the former.

Skummet aims to ensure maximum compatibility and, although there could be issues with code that relies on referencing Vars directly, most Clojure code should be compatible out of the box, according to Skummet’s creator Alex Yakushev.

Overall, Skummet is able to bring a 4x reduction in load time on a simple benchmark app’s first launch, and 2x shrinking in both APK size and heap usage. According to SwiftKey’s Adam Clements and Ben Leavett, using Skummet has allowed them to keep Clarity Keyboard’s loading time around 1.5–2 seconds, and further improvements are possible.

Other useful tools for Clojure development on Android are packed under the umbrella project of Clojure-Android Initiative and include:

  • lein-droid: a Leiningen plugin that works as a build tool for Clojure-Android projects and deals with the process of packaging resources, creating an APK file, signing it, etc.
  • Neko: a toolkit that wraps some parts of Android’s Java API to make them more idiomatic to use from Clojure.

Zach Oakes, author of the Nightweb app for Android, says that Clojure can make an app’s codebase “shockingly” smaller by enabling terse idioms, as well as improve the app responsiveness by making it easier for the programmer to run asynchronous tasks.

According to SwiftKey’s engineers, the use of Clojure to build an Android app can have a huge impact on the app design. Specifically, in Clarity Keyboard’s case, it made it possible to adopt a fully “event driven” design, which coupled with the use of immutable data structure allows to easily store and “replay” any user actions. Using immutable data also helped build a highly modular app and make every operation asynchronous by default.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Native App Development is the Future by Dipti Arora

Hello,

This is really an informative blog for all the beginners as well as app developers. App demand will surely increase day by day, as it is the main reason behind the business success.

I am an app developer, I have tried most of the mobile app development platforms. I have developed more than 50 apps till today with the help of Phonegap, Telerik, Configure.IT etc. They are running successfully on app store.

As per my experience in this field, I recommend developers as well as beginners to use mobile app development platform like Configure.IT, because it provides automatic coding, app preview facility, direct API connect and a lot more features. These things save a lot more development time and provides fast and well designed app in much less time.

Read more: www.configure.it/features/mobile-app-configurat...

This app development platform is fully Native cross app development tool.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT