Java 生成APK时出错{重复条目:com/google/android/gms/gcm/inetworkstaskcallback$Stub.class}
嗨,我正在尝试构建APK,但我在Android Studio中解决了这个问题Java 生成APK时出错{重复条目:com/google/android/gms/gcm/inetworkstaskcallback$Stub.class},java,android,firebase,gradle,apk,Java,Android,Firebase,Gradle,Apk,嗨,我正在尝试构建APK,但我在Android Studio中解决了这个问题 Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/google/android/gms/gcm/inetworkstaskCallbac
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/google/android/gms/gcm/inetworkstaskCallback$Stub.class
渐变文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.mouad.fixmyphone"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
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:design:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
本文件仅包括以下内容之一:
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
你们两个都包括在内。因为您的应用程序不依赖于com.google.android.gms:play services gcm
,所以您应该只包含以下库:
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
从依赖项中删除此行:
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
本文件仅包括以下内容之一:
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
你们两个都包括在内。因为您的应用程序不依赖于com.google.android.gms:play services gcm
,所以您应该只包含以下库:
compile 'com.firebase:firebase-jobdispatcher:0.5.2'
从依赖项中删除此行:
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
可能会有帮助好吧,让我把这个投票给其他人,让他们更多地关注你,这样你可以更快地回答可能会有帮助好吧,让我把这个投票给其他人,让他们更多地关注你,这样你可以更快地回答,你节省了我一天的时间,我花了一整天的时间来解决这个问题,非常感谢你还有其他需要考虑的事情:你正在使用传统的Firebase SDK,
Firebase客户端android:2.5.2
和新的SDK,com.google.Firebase:Firebase messaging:10.2.1
。这现在可能可以工作,但如果继续从新SDK添加LIB,则可能会遇到冲突。这是一个很好的资源。感谢您的观察,我应该删除哪一个:firebase客户端android:2.5.2或com.google。firebase:firebase messaging:10.2.1删除firebase客户端android:2.5.2
。如果这会产生错误,请按照升级指南中的说明进行操作。我删除了firebase客户端android:2.5.2,一切正常,谢谢你的帮助,meMan,你节省了我一天的时间,我花了一整天的时间来解决这个问题,非常感谢,还有一件事需要考虑:你正在使用传统的firebase SDK,firebase客户端android:2.5.2
和新的SDK,com.google.firebase:firebase messaging:10.2.1
。这现在可能可以工作,但如果继续从新SDK添加LIB,则可能会遇到冲突。这是一个很好的资源。感谢您的观察,我应该删除哪一个:firebase客户端android:2.5.2或com.google。firebase:firebase messaging:10.2.1删除firebase客户端android:2.5.2
。如果出现错误,请按照升级指南中的说明进行操作。我删除了firebase客户端android:2.5.2,一切正常,谢谢您的帮助