2017-08-23 55 views
7

當我建立我的項目,我得到了以下錯誤:的Android 3.0工作室β2

Error:com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/app_debug.kotlin_module'

這裏是我的build.gradle文件

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
     google() 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
    } 

    apply plugin: 'com.android.application' 
    apply plugin: 'io.fabric' 
    apply plugin: 'kotlin-android' 
    apply plugin: 'kotlin-android-extensions' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.e9innovation.infrastructure" 
     multiDexEnabled true 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 

     vectorDrawables.useSupportLibrary true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 

     debug { 
      signingConfig signingConfigs.debug 
     } 
    } 

    signingConfigs { 
     debug { 
      storeFile file('../keystores/debug.keystore') 
      storePassword 'android' 
      keyAlias 'androiddebugkey' 
      keyPassword 'android' 
     } 
    } 

    lintOptions { 
     abortOnError false 
    } 
} 

ext { 
    supportLibVersion = "26.0.1" 
    playServicesVersion = "11.2.0" 
} 

repositories { 
    mavenCentral() 
    maven { url 'https://maven.fabric.io/public' } 
    google() 
} 


dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    testCompile 'junit:junit:4.12' 
    compile "com.android.support:appcompat-v7:${supportLibVersion}" 
    compile "com.android.support:design:${supportLibVersion}" 
    compile "com.android.support:support-v4:${supportLibVersion}" 
    compile "com.android.support:cardview-v7:${supportLibVersion}" 
    compile "com.android.support:exifinterface:${supportLibVersion}" 
    compile "com.google.android.gms:play-services-base:${playServicesVersion}" 
    compile "com.google.android.gms:play-services-maps:${playServicesVersion}" 
    compile "com.google.android.gms:play-services-gcm:${playServicesVersion}" 
    compile "com.google.android.gms:play-services-location:${playServicesVersion}" 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile "com.android.support:percent:${supportLibVersion}" 
    testCompile 'junit:junit:4.12' 


    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 

    //apache commons 
    compile 'org.apache.commons:commons-lang3:3.5' 

    compile "com.google.firebase:firebase-database:${playServicesVersion}" 
    compile "com.google.firebase:firebase-storage:${playServicesVersion}" 
    compile "com.google.firebase:firebase-auth:${playServicesVersion}" 
    compile 'com.firebase:geofire-android:2.1.1' 

    compile 'com.github.bumptech.glide:glide:4.0.0' 
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0' 

    compile 'com.github.chrisbanes:PhotoView:2.1.3' 

    compile project(path: ':searchView') 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
} 

apply plugin: 'com.google.gms.google-services' 

附:我將我的Android工作室升級到3.0節拍-2,並且出現此問題。 誰有想法是什麼?

+0

出於某種原因,在您的項目中打包在一起的幾個模塊的Kotlin輸出包含相同的'* .kotlin_module'文件,或嘗試打包重複的Kotlin輸出(更可能)。我會盡快在不久的將來重現這個問題。你的項目是開源的嗎? – hotkey

+0

@hotkey不是我的項目不是開源的,謝謝你的幫助讓我知道我們可以親自交談! –

+0

也在AS 3.0版本中發生。 –

回答

8

首先使緩存失效並重新啓動,然後清理項目並重建它.hope有幫助。

+1

謝謝,這救了我! –

+0

很高興幫助:) –

0

首先清理緩存使用下面的命令根據您的操作系統:

在Windows上:

gradlew cleanBuildCache 

在Mac或Linux:

./gradlew cleanBuildCache 

經過這種清潔和重建項目。