killertask - Android AsyncTask wrapper library, written in Kotlin - Kotlin Resources


This is a Kotlin Android library to create async background tasks. Inspired by TinyTask, but more beautiful and easy to use for Kotlin Android developments.


Android’s AsyncTasks are highly criticized for being bad, unreliable, outdated, etc. Are they perfect? No. Do we have better alternatives? Sure, but sometimes all we want is a quick and simple way to run something in the background.

What is it, really?

Just a wrapper around an AsyncTask, with a funny looking API. The main difference between KillerTask and TinyTask is that this library is written in Kotlin language, very different from Java. To learn how to use Kotlin in your Android app you can visit: Android development with Kotlin

How to download and install it

Add the following to your build.gradle file:

repositories {
	maven {
		url ""

dependencies {
	// ...
  compile 'com.github.inaka:killertask:v1.2'
  // ...

Code examples

    val onSuccess: (String) -> Unit = {
        result: String ->"result", result)

    val onFailed: (Exception?) -> Unit = {
        e: Exception? ->"result", e.toString())

    val doWork: () -> String = {
        "test" // implicit return

    var killerTask = KillerTask(doWork, onSuccess, onFailed)
    killerTask.go() // to execute it 
    killerTask.cancel() // to cancel it

Or simply you can do:

            { "test" }, // task
            {result: String ->"result", result)}, // onSuccess actions
            {e: Exception? ->"result", e.toString())} // onFailed actions

Actually, the only strongly necessary parameter is the first one (the main task):

    KillerTask({"LOG", "KillerTask is awesome") }).go() // only main task
            {"LOG", "KillerTask is awesome") }, // main task
            {"LOG", "Super awesome!")} // onSuccess
            { // main task
      "LOG", "KillerTask is awesome")
                "super" // implicit return
            {}, // onSuccess is empty
            { e: Exception? ->"LOG", e.toString()) } // onFailed

Example of an app using KillerTask

Contact Us

If you find any bugs or have a problem while using this library, please open an issue in this repo (or a pull request :)).

compile "com.github.inaka:killertask:1.4"

Related Libraries


A Kotlin DSL wrapper around the mikepenz/MaterialDrawer library.

Last updated 3 mins ago


Minimal UI library for Android inspired by React

Last updated 3 mins ago


Advancement Utils for Android Developer written in Kotlin

Last updated 3 mins ago


The Android maps adapter

Last updated 3 mins ago


Screen orientation detector for android

Last updated 3 mins ago