2017-03-06 6 views
1

ich mein Android-Projekt bin Gebäude mit build.gradle folgendenGradle bauen für android Projekt scheiterte

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 
android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.handyman.user" 
     minSdkVersion 14 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/notice.txt' 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.1.1' 
    compile 'com.android.support:cardview-v7:25.1.1' 
    compile 'com.android.support:design:25.1.1' 
    compile 'com.android.support:percent:25.1.1' 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    testCompile 'junit:junit:4.12' 
    compile 'com.github.ronaldsmartin:Material-ViewPagerIndicator:1.0.2' 
    compile 'com.github.florent37:singledateandtimepicker:1.0.8' 

    // retrofit essentials 
    compile 'com.squareup.retrofit2:retrofit:2.0.2' 
    compile 'com.squareup.retrofit2:converter-gson:2.0.2' 

    // retrofit logging 
    compile 'com.facebook.stetho:stetho:1.3.1' 
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.1' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0' 

    compile 'uk.co.chrisjenx:calligraphy:2.2.0' 

    compile 'com.google.firebase:firebase-messaging:10.0.1' 

    compile 'com.android.support:multidex:1.0.1' 
} 

aber mein Build ist dies nicht, sagt

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/internal/zzv$zza$zza.class 

In meiner App multidex aktiviert ist. Ich habe versucht, das Projekt mehrfach zu bereinigen und neu aufzubauen, ohne irgendein Ergebnis zu haben, und habe versucht, die Version der Firebase-Abhängigkeit zu ändern, aber das war auch nutzlos.

+0

Gibt es etwas im 'libs' Ordner? – Egor

+1

@Egor kein libs Ordner ist leer. – darthvish

+0

Versuchte Gebäude/Reinigungsprojekt? – shadygoneinsane

Antwort

0

Versuchen Sie, dies zu build.gradle hinzuzufügen.

android{ 


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

} 

Credits: java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex

+0

sollten Sie geben Kredit zu dieser Antwort ... http: //stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult – rafsanahmad007

0

löste ich dieses Problem, indem Sie diese Zeile apply plugin: 'com.google.gms.google-services' von build.gradle am Boden setzen, anstatt unter apply plugin: 'com.android.application'