摇篮构建失败的Android项目
问题描述:
我建设我的Android项目具有以下的build.gradle摇篮构建失败的Android项目
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'
}
,但我的编译失败它说
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
在我的应用程序multidex启用。我多次尝试清理和重建项目而没有任何结果,并试图将firebase依赖的版本更改为不同的版本,但那也没用。
答
尝试将此添加到build.gradle
。
android{
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
}
现金java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex
+0
你应该给信用这个答案... http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult – rafsanahmad007
答
我解决放上这行apply plugin: 'com.google.gms.google-services'
在build.gradle
底部,而不是下面apply plugin: 'com.android.application'
有什么在'libs'文件夹这个问题? – Egor
@Egor没有库文件夹是空的。 – darthvish
试过建筑/清洁工程? – shadygoneinsane