2016-09-17 7 views
1

내 프로젝트의 서명 된 APK를 구축하려고하고 난 다음 오류 얻을 : 실행은 작업에 실패안드로이드 스튜디오 : 오류 : ': 응용 프로그램 : transformClassesWithJarMergingForRelease'

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

내가 디버그 빌드 유형을 선택 오류가없고 모든 것이 잘 작동합니다. 나는이 문제를 해결하기 위해 잠시 동안 수색했지만 쓸모없는 것을 찾지 못했습니다.

내 build.gradle :

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

android { 
compileSdkVersion 24 
buildToolsVersion "24.0.1" 
defaultConfig { 
    applicationId "com.danielsous.demos" 
    minSdkVersion 14 
    targetSdkVersion 24 
    multiDexEnabled true 
} 
buildTypes { 
    release { 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 
productFlavors { 
} 

} 


dependencies { 
compile files('libs/scanditsdk-android-4.7.5.jar') 
compile 'com.android.support:support-v4:24.2.1' 
compile 'com.github.attenzione:android-ColorPickerPreference:e3aa301016' 
compile 'com.google.firebase:firebase-messaging:9.4.0' 
compile 'com.google.code.gson:gson:2.7' 
} 

다른 build.gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.1.3' 
    classpath 'com.google.gms:google-services:3.0.0' 
} 
} 

allprojects { 
repositories { 
    jcenter() 
    maven { 
     url "https://jitpack.io" 
    } 
} 
} 
+0

일부 중복 클래스의 gradle 파일은 일부 gradle 클래스를 확인하기 위해 일부 gradle 종속성을 제거합니다 – siddhesh

+0

몇 가지 다른 방법으로 프로젝트를 정리 한 후 프로젝트가 완성되었습니다. –

+0

와우 명성 ... !!! – siddhesh

답변

1

당신이 직면 할 때마다 "당신이 적어도 하나의 라이브러리가 이미 GMS와 함께 번들로있는 것 같다" 중복 입력 오류 ./gradlew app : dependencies를 실행하고 동일한 모듈의 중복 된 버전이 없는지 확인하십시오. 예를 들어 내 경우에는 내가 있었다 :

나는를 탐색 할 때 내 응용 프로그램 충돌 원인을하게
compile 'com.google.android.gms:play-services-gcm:9.0.0' 
When I tried to use firebase in my project I add it like: 

compile 'com.google.firebase:firebase-core:9.+' 
compile 'com.google.firebase:firebase-messaging:9.+' 

: 응용 프로그램>> 중간체를 구축> 폭발 - AAR>는 폴더 중 하나 (com.google.android.gms 이론적으로

compile 'com.google.firebase:firebase-core:9.0.0' 
compile 'com.google.firebase:firebase-messaging:9.0.0' 

는 9.4에 중포 기지를 눌러이 너무 해결할 수 : 플레이 서비스 - 지하) 같은 중포 기지를 추가하여 버전을 unificate하는 것이었다 그래서 내가 한 버전 9.4.0 대신 9.0.0을 당겨 .0 대신 .0.

0

동일한 이름의 여러 리소스 (동일한 이름의 파일, 같은 ID의 문자열, 동일한 파일의 레이아웃)가 포함 된 aar 파일로 만든 두 번째 라이브러리와 라이브러리가 하나 있습니다. aar 라이브러리를 제거하면 내 문제가 해결되었습니다