When building a Kotlin/Multiplatform library for iOS, the documentation and most examples show how to build for either x86 or ARM64. However, what if you’d actually want to use your library both on iPhone devices as well as the iOS Simulator. Here’s how to build a fat framework with plain Gradle.

In this article, we’ll look at a real-world example; Log4K, a lightweight logging library for Kotlin/Multiplatform that supports Android, iOS, JavaScript and plain JVM environments. We’ll start of by declaring the supported iOS architectures and the final framework name, e.g. Log4K.framework:

kotlin { iosArm64 { binaries.framework("Log4K") } iosX64 {…


Using Gradle 6, Kotlin DSL and Dokka.

Many guides and how-to’s about publishing Android libraries use outdated information. While the (deprecated) Gradle maven plugin, bintray or artifactory plugins continue to work just fine, things look a little different when using Gradle Kotlin DSL. Also, when creating Android libraries written in Kotlin, code documentation should use Dokka, not Javadoc.

The examples used in this post are based of android-customtabs, a convenience library for Chrome CustomTabs.

Gradle plugins

We’ll be using the modern maven-publish plugin for uploading and Jetbrains’ Dokka plugin to build the code documentation:

plugins {
// ...
id("org.jetbrains.dokka") version "0.10.1"
`maven-publish`
}

As usual, any publication that is…


Even though we’re approaching the minimum of the current solar cycle, occasional sunspots still appear.

Taken on 21st of April, 2018 using a Skyris 132M Camera using Baader Solar Continuum filter through an Edge HD 8”.

This was the best shot out of a serious of 35 captures taken with FireCapture and stacked with AutoStakkert. Final touch ups (I had some dust on the sensor) where done with GIMP.


Working with Custom Tabs isn’t exactly straightforward. Even minimal examples involve quite a bit of code:

What makes it worse is that one can’t expect Chrome to be available on any device. That means additional code to fall back to good old WebView. To simplify the experience, there is a new library available that provides a higher-level interface that implements many often-needed convenience features:

To create a new CustomTabsIntent and start it with a keep-alive service as well as a fallback:

CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() .addDefaultShareMenuItem() .setToolbarColor(this.getResources() .getColor(R.color.colorPrimary)) .setShowTitle(true) .setCloseButtonIcon(backArrow) .build(); // This is optional but recommended CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent)…


For an upcoming Android App project of mine I had to parse PLS (or just Playlist) files. I decided to make this a generic Android library ready for re-use. It’s braindead simple to use:

// ...
Playlist playlist = PlaylistParser.parse(inputStream);
for (Playlist.Track track : playlist.getTracks()) {
track.getFile();
track.getTitle();
// ...
}

Based on an InputStream (previously retrieved from a file or URL) you’ll get a Playlist class you can ask for tracks. The same works for Strings as well:

// ...
Playlist playlist = PlaylistParser.parse(string);
for (Playlist.Track track : playlist.getTracks()) {
track.getFile();
track.getTitle();
// ...
}

That’s all there is to say. It’s available on Github. You can find it on Android Arsenal as well.

Sascha Peilicke

Geek head. Music lover.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store