我已将Kotlin库添加到现有项目中.之后我得到了构建错误.我评论了最近添加的所有库,并检查了添加kotlin库后的主要问题
Error:Execution Failed for task ':app:transformClassesWithMultIDexListForDeBUG'.> java.io.IOException: Can't write [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/multi-dex/deBUG/componentClasses.jar] (Can't read [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/transforms/desugar/deBUG/76.jar(;;;;;;**.class)] (Duplicate zip entry [76.jar:org/intellij/lang/annotations/Flow.class]))
项目gradle
buildscript { ext.kotlin_version = '1.2.21' repositorIEs { Google() jcenter() } dependencIEs { classpath 'com.androID.tools.build:gradle:3.0.1' classpath 'com.Google.gms:Google-services:3.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath ('com.Google.firebase:firebase-plugins:1.0.5') { exclude group: 'com.Google.guava',module: 'guava-jdk5' } }}allprojects { repositorIEs { Google() jcenter() maven {url "https://maven.Google.com"} }}
而应用程序是gradle
apply plugin: 'com.androID.application'apply plugin: 'com.Google.firebase.firebase-crash'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions'apply plugin: 'kotlin-kapt'androID { compileSdkVersion 27 buildToolsversion '27.0.3' defaultConfig { applicationID 'com.example.androID' minSdkVersion 20 targetSdkVersion 27 versionCode 17 versionname "1.0" multIDexEnabled true vectorDrawables.useSupportlibrary = true } buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'),'proguard-rules.pro'// proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro' } deBUG { buildConfigFIEld("String","BASE_URL","\"url\"") buildConfigFIEld("String","API_KEY","\"key\"") } } productFlavors { } dexOptions { preDexlibrarIEs = false javaMaxHeapSize "4g" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } packagingOptions { exclude 'meta-inf/liCENSE.txt' exclude 'meta-inf/NOTICE.txt' exclude '.readme' }}dependencIEs { compile filetree(include: ['*.jar'],dir: 'libs') compile project(':controllers') compile files('libs/achartengine-1.2.0.jar') compile files('libs/dfulibrary.jar') compile 'com.androID.support:appcompat-v7:27.0.2' compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" compile 'com.androID.support:design:27.0.2' compile 'com.androID.support:recyclervIEw-v7:27.0.2' compile 'com.androID.support:cardvIEw-v7:27.0.2' compile 'com.polIDea.rxandroIDble:rxandroIDble:1.0.2' compile 'com.Google.firebase:firebase-crash:11.8.0' compile 'com.androID.support.constraint:constraint-layout:1.1.0-beta4' compile 'com.androID.support:support-v4:27.0.2' compile 'com.Google.androID.gms:play-services-location:11.8.0' compile 'com.jakewharton:butterknife:8.8.1' testCompile 'junit:junit:4.12' /*compile 'org.hashids:hashids:1.0.3' compile 'com.Google.dagger:dagger:2.11' compile 'javax.inject:javax.inject:1' kapt 'com.Google.dagger:dagger-compiler:2.11' compile 'io.reactivex.rxjava2:rxjava:2.1.3' compile 'io.reactivex.rxjava2:rxandroID:2.0.1' kapt 'com.jakewharton:butterknife-compiler:8.8.1' compile 'com.amitshekhar.androID:rx2-androID-networking:1.0.0' compile 'com.androID.support:multIDex:1.0.2'*/}apply plugin: 'com.Google.gms.Google-services'
如果我从应用程序gradle中删除以下行,一切正常.但是如果我添加kotlin库我就会收到错误.
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
我如何一起使用kotlin和Java.最佳答案Atlast我找到了答案,这是由于重复输入注释,可以通过使用gradle中的以下行来解决.
configurations { compile.exclude group : 'org.jetbrains',module : 'annotations'}
总结 以上是内存溢出为你收集整理的Java和Kotlin结合构建错误(重复Zip条目)全部内容,希望文章能够帮你解决Java和Kotlin结合构建错误(重复Zip条目)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)