Gradle构建转换错误

时间:2017-03-17 08:57:04

标签: android android-gradle

  

错误:任务执行失败   ':应用程序:transformClassesWithJarMergingForDebug'

     
    

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:     螺栓/ AggregateException.class

  

build.gradle文件

android {
compileSdkVersion 25
buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 14
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


}



dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'se.emilsjolander:stickylistheaders:2.5.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
//compile 'com.google.firebase:firebase-messaging:10.2.0'

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

3 个答案:

答案 0 :(得分:0)

compile 'com.android.support:appcompat-v7:21.0.3'更改为compile 'com.android.support:appcompat-v7:25.0.0'并重建项目。

答案 1 :(得分:0)

尝试在应用级等级(build.gradle)中添加以下代码:

dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}

另外,请确保将manifest的应用程序标记的name属性设置为MultidexApplication。

答案 2 :(得分:0)

尝试以下代码:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    NSLog( @"text changed: %@",textField.text);
    [self ProdcutDirectSetToCartAPICall];
    return YES;
}