Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin Gradle issue

I have created a Jar of a project written in Kotlin language. Jar contains following folders :

com
jet
kotlin
meta-inf
okio
org

Then I created an android project and added Kotlin and the Jar as dependency.

When I try to execute the hello world app it throws following exception.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1

My app build gradle file is

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "abc.xyz.kotlin"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile files('libs/xyz.jar')
}
buildscript {
    ext.kotlin_version = '0.12.1218'
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
repositories {
    mavenCentral()
}

Can you please help me to resolve this issue?

like image 936
manish Avatar asked Jul 30 '15 07:07

manish


1 Answers

My Jar was containing Kotlin runtime and I configured Kotlin in my android project also. These two Kotlin configuration were causing problem. After removing Kotlin from my Jar it started working.

like image 67
manish Avatar answered Nov 08 '22 17:11

manish