2016-05-16 103 views
1

我生成在Android Studio中籤署過的APK,但我得到以下錯誤:無法生成Android Studio中籤署APK,得到錯誤

Error:Execution failed for task ':msapp_V_520:transformClassesWithJarMergingForRelease'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/ColorRes.class

這是我的build.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' } 
} 


android { 
    signingConfigs { 
     release { 
     } 
    } 
    configurations { 
     all*.exclude group: 'com.android.support', module: 'support-v4' 
    } 

    compileSdkVersion 23 
    buildToolsVersion '23.0.3' 
    defaultConfig { 
     applicationId "com.mouthshut" 
     minSdkVersion 14 
     targetSdkVersion 23 
     multiDexEnabled true 
     useLibrary 'org.apache.http.legacy' 
     compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_7 
      targetCompatibility JavaVersion.VERSION_1_7 
     } 
    } 
    dexOptions { 
     incremental true 
     javaMaxHeapSize "4g" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      shrinkResources false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 

     } 
    } 
} 

dependencies { 

    compile project(':comnostra13exampleuniversalimageloaderHomeActivity') 
    compile project(':nineoldandroid') 
    compile project(':libraryActionbar') 
    compile project(':pullToRefresh') 
    compile project(':facebook') 
    compile 'com.google.android.gms:play-services:+' 
    compile 'com.android.support:multidex:1.0.+' 
    compile files('libs/AF-Android-SDK-v2.3.1.19.jar') 
    compile files('libs/classes.jar') 
    compile files('libs/CleverTapAndroidSDK-v1-20150903.jar') 
    compile files('libs/YouTubeAndroidPlayerApi.jar') 
    //compile 'com.github.adrian110288:LoadIndicators:83ce610325' 
    compile project(':LoadIndicatorLibrary') 
    compile 'com.nispok:snackbar:2.11.+' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.android.support:appcompat-v7:23.3.0' 
} 
+0

您的gradle依賴關係存在問題。請檢查一下。 –

+0

@MadhukarHebbar請參閱我編輯的問題它包括我的build.gradle文件,請給出關於這個問題的建議。 – user2107940

+0

Facebook SDK可能會與支持庫衝突.Chek [here](http://stackoverflow.com/questions/17693651/facebook-integration-android-support-v4-content-localbroadcastmanager)和[here](http:// stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult)。它可能會幫助你。 –

回答

0

添加facebook依賴項時排除support-v4模塊。

compile (project(':facebook')) { 
    exclude module: 'support-v4' 
} 
+0

我試過你的解決方案,但它不工作。 – user2107940