Clojuresque is incompatible with Android

Issue #20 new
created an issue

The clojuresque-base applies the 'java' plug-in, but this is incompaible with the 'android' plugin. What is the best way to resolve this incompatibility?

Comments (6)

  1. Steve Moseley

    This is still a problem. I've been trying to use Cursive in Android Studio, and have logged an issue with the Cursive team here:

    and also on stackoverflow here:

    Here is the error that appears when trying to use Clojuresque in Android Studio:

    Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

    If there's anything I can do to help investigate this issue, please let me know.

  2. Meikel Brandmeyer

    I don't know what to do about this. As of now, clojuresque uses things like SourceSets etc. which are introduced by the java plugin. I don't know about android development. So if anyone having a way to test things is willing to investigate how to improve/fix this, this help would be highly appreciated.

  3. Steve Moseley

    Thanks for the reply Meikel. I'd be happy to help out where I can, I've done a fair amount of Android development, but my knowledge of Gradle is limited.

    There may be a way to get this working by configuring the Gradle scripts correctly (Android Studio generates two scripts, one at the root and one in a module where your code lives)

    For example, in a sample, empty project, here is the project root Gradle script:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
        dependencies {
            classpath ''
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
    allprojects {
        repositories {
    task clean(type: Delete) {
        delete rootProject.buildDir

    and here is the Gradle script in the "app" module, where your code lives:

    apply plugin: ''
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
        defaultConfig {
            applicationId "com.steve.testclojureandroidstudio2"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile ''

    So where I should put the Clojuresque dependencies and other settings, I'm not sure ?

  4. Meikel Brandmeyer

    In the best case one could add a check in clojuresque to see whether the android property on the project exists and then skip the application of the java plugin. The user would just have to apply clojuresque after the android plugin. However, we have to investigate the inner guts of the android plugin to make clojuresque work with it. Again: in the best case this is straight forward.

    All in all this sucks. Replacing core logic from built-in plugins is not the best solution one can imagine. 😕

    I suggested a split in the past to extract source sets and such into a neutral base plugin without applying the java stuff, but never found the time to provide a patch to the gradle team. And for them it was not a high priority.

  5. Steve Moseley

    I was hoping for an easy solution, but it seems like that's not the case. Looks like I'll just have to wait around until an alternative solution comes along.

    Thanks for looking into this Meikel, I appreciate it.

  6. Log in to comment