2016-10-12 8 views
3

ビルドエラーの取得:duplicate entry: javax/annotation/CheckForNull.class私のアプリケーションの署名付きapkを生成しようとするたびに。私は周りのグーグルで見つけたすべての修正を試して、何をやり直すべきか分からない。私のgradleファイルを見て、そこに問題があるかどうか確認してください。おかげで以下ビルドエラーの取得: `重複エントリ:javax/annotation/CheckForNull.class`

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/CheckForNull.class 

は私のGradleファイルです:私のアンドロイドのスタジオを通って行く

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

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
} 

apply plugin: 'realm-android' 
apply plugin: 'me.tatarka.retrolambda' 
apply plugin: 'android-apt' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "co.companyname.theapp" 
     minSdkVersion 15 
     targetSdkVersion 24 
     versionCode 1 
     versionName "0.0.1" 
     vectorDrawables.useSupportLibrary = true 
     multiDexEnabled true 
    } 

    /** 
    * This is for jenkins only. Always comment out if not Jenkins 
    * */ 
    lintOptions { 
     abortOnError false 
    } 

    dataBinding { 
     enabled = true 
    } 

    dexOptions { 
     javaMaxHeapSize "4g" 
     preDexLibraries = false 
    } 

    signingConfigs { 
     debug { 
      keyAlias keystoreProperties['keyAlias'] 
      keyPassword keystoreProperties['keyPassword'] 
      storeFile file(keystoreProperties['storeFile']) 
      storePassword keystoreProperties['storePassword'] 
     } 

     release { 
      keyAlias keystoreProperties['keyAlias'] 
      keyPassword keystoreProperties['keyPassword'] 
      storeFile file(keystoreProperties['storeFile']) 
      storePassword keystoreProperties['storePassword'] 
     } 
    } 

    buildTypes { 
     release { 
      resValue 'string', 'APP_NAME', '"APP"' 
      multiDexEnabled true 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 

      signingConfig signingConfigs.release 
      ext.betaDistributionReleaseNotes="Release Notes for this build." 
      ext.betaDistributionGroupAliases="Production" 
      ext.betaDistributionEmails="[email protected]" 
      ext.betaDistributionNotifications=true 
     } 

     debug { 
      applicationIdSuffix ".dev" 
      versionNameSuffix "-dev" 
      resValue 'string', 'APP_NAME', '"APP Dev"' 
      multiDexEnabled true 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 

      signingConfig signingConfigs.debug 
      ext.betaDistributionReleaseNotes="Bla bla bla" 
      ext.betaDistributionGroupAliases="Bla" 
      ext.betaDistributionNotifications=true 
     } 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_8 
     targetCompatibility JavaVersion.VERSION_1_8 
    } 

    packagingOptions { 
     exclude 'META-INF/services/javax.annotation.processing.Processor' 
     exclude 'LICENSE' 
     exclude 'LICENSE.txt' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    /*Basic Needs The support libraries*/ 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.android.support:support-v4:24.2.1' 
    compile 'com.android.support:cardview-v7:24.2.1' 

    /** 
    *Reactive Programming for both UI and making request using Reactive Programming 
    * */ 
    compile 'io.reactivex:rxandroid:1.0.1' 
    compile 'io.reactivex:rxjava:1.0.14' 

    /** 
    * Java 8 Stream support for pre Java8 
    * */ 
    compile 'com.annimon:stream:1.0.9' 

    /** 
    *Retrofit and OKHTTP For making Restful API request 
    * */ 
    compile 'com.squareup.retrofit2:retrofit:2.1.0' 
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1' 
    compile 'com.squareup.okhttp3:okhttp:3.4.1' 

    /** 
    * Stetho to debug app using Chrome Inspect 
    * */ 
    compile 'com.facebook.stetho:stetho:1.3.1' 
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.1' 

    /** 
    * Afollestad Modified Material Dialog 
    * */ 
    compile 'com.afollestad.material-dialogs:core:0.8.6.2' 

    /** 
    * Apache common is a collection of reusable components. 
    * */ 
    compile ('org.apache.commons:commons-collections4:4.0') { 
     transitive = false 
    } 
    compile ('org.apache.commons:commons-lang3:3.4') { 
     transitive = false 
    } 
    compile ('commons-io:commons-io:2.4') { 
     transitive = false 
    } 

    /** 
    * Joda Time is for managing Time and Date and recent function present in Java 8 but 
    * */ 
    compile 'net.danlew:android.joda:2.9.3.1' 

    /** 
    * Dependency Injection 
    * */ 
    compile 'com.google.dagger:dagger:2.7' 
    compile 'com.google.dagger:dagger-compiler:2.7' 

    /** 
    * Views invjection 
    * */ 
    compile 'com.jakewharton:butterknife:8.4.0' 
    apt 'com.jakewharton:butterknife-compiler:8.4.0' 

    /** 
    * Image Loading 
    * */ 
    compile 'com.github.bumptech.glide:glide:3.7.0' 

    /** 
    * Permission helper 
    * */ 
    compile 'com.github.k0shk0sh:PermissionHelper:1.0.9' 

    compile 'net.cachapa.expandablelayout:expandablelayout:2.3' 

    /** 
    * Image Picker 
    * */ 
    compile 'com.github.nguyenhoanglam:ImagePicker:1.1.2' 

    /** 
    * Pusher 
    * */ 
    compile 'com.pusher:pusher-java-client:1.2.1' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
} 

retrolambda { 
    javaVersion JavaVersion.VERSION_1_7 
    defaultMethods false 
} 

、私は2つの依存関係はCheckForNull.classを持って見ることができますが、その後どのように私はそれをCheckForNull.class

+0

* CheckForNull.class *を検索し、エントリが複数の場合は削除します。 * CheckForNull.class *を1つだけ保持してください。アンドロイドスタジオでは、それをcntr + Nで見つけることができます。 –

+0

私はそれを見つけることができます。しかし、どのように依存関係からそれらを削除できますか? –

+0

最初にあなたのプロジェクトをきれいにしようとすると、うまくいくかもしれません –

答えて

2

を削除することができますまあ、私は解決私の問題は、dagger compiler依存のcompileaptに置き換えます。

/** 
* Dependency Injection 
* */ 
apt 'com.google.dagger:dagger-compiler:2.7' 
compile 'com.google.dagger:dagger:2.7' 
provided 'javax.annotation:jsr250-api:1.0' 
関連する問題