当我运行应用程序时,我在Android项目中收到此错误。
Error:Execution failed for task :app:transformClassesWithJarMergingForDebug.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzaj.class
这是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.akapoor.kiittimetabletest1"
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: "6cebaxxx-xxxx-xxxx-89af-55fbddb523ea",
onesignal_google_project_number: "4283878xxx"]
minSdkVersion 15
targetSdkVersion 23
versionCode 5
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.pushbots:pushbots-lib:2.0.13@aar'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.onesignal:OneSignal:2.+@aar'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile "com.google.android.gms:play-services-location:+"
}
我尝试过在其他stackoverflow答案上发布的解决方案,但没有一个对我有用。请检查代码。 谢谢你:)
答案 0 :(得分:0)
请使用实际版本号,而不是加载
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile "com.google.android.gms:play-services-location:+"
确保所有版本都匹配
compile 'com.google.android.gms:play-services-ads:9.4.0'