在OS独立路径'META-INF / deserialization.kotlin_module'中找到了多个文件

时间:2018-04-02 20:19:24

标签: android kotlin

我必须使用Kotlin构建一个评估Kotlin代码的Android应用程序。为了实现这一点,我需要导入依赖项org.jetbrains.kotlin:kotlin-compilerorg.jetbrains.kotlin:kotlin-script-util,如下所示:

rks module gradle

buildscript {
    ext.kotlin_version = '1.2.31'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'kotlin'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-compiler:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-script-util:$kotlin_version"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
比app module gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "it.matteopellegrino.kotlinsample"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "0.0.1"
        testInstrumentationRunner  "android.support.test.runner.AndroidJUnitRunner"
        }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile project(":rks")
}

导入这些依赖项时,Gradle sync可以正常工作,但运行失败并显示此错误

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
More than one file was found with OS independent path 'META-INF/deserialization.kotlin_module'

不能 exclude packagingOptions,因为它会破坏整个kotlin运行。

根据this article,它似乎是库之间的命名冲突,但所提供的解决方案对我不起作用。

我该如何解决这个问题?

0 个答案:

没有答案
相关问题