Error:com.duplicate entry: com/google/android/gms/internal/zzfj.class

Viewed 56

I'm trying to port an old android app to new devices. It works well from Android 5.x to 7.1, but it doesn't work in Android 4.x versions.

When I try to install it in an android device or in a emulator with Android 4.x the build always fails with the same exception:

Error:com.duplicate entry: com/google/android/gms/internal/zzfj.class

apply plugin: 'com.android.application'

android {
  compileSdkVersion 25
  buildToolsVersion "25.0.2"
  defaultConfig {
    applicationId "sigmanews.sigmamentors"
    manifestPlaceholders = [onesignal_app_id: "c4321xxx-f85a-4ba1-983f-cc1399efb839",
      // Project number pulled from dashboard, local value is ignored.
      onesignal_google_project_number: "REMOTE"
    ]
    minSdkVersion 17
    targetSdkVersion 25
    versionCode 21
    versionName "23"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

repositories {
  mavenCentral()
  maven {
    url "https://jitpack.io"
  }
  maven {
    url "https://mint.splunk.com/gradle/"
  }
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  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.3.1'
  compile 'com.android.support.constraint:constraint-layout:1.0.2'

  compile "com.google.android.gms:play-services-ads:10.0.1"
  compile 'com.mcxiaoke.volley:library-aar:1.0.0'
  compile 'com.github.bumptech.glide:glide:3.7.0'
  compile 'com.github.tarek360:instacapture:2.0.0-kotlin-beta1'
  compile 'com.android.support:cardview-v7:25.1.0'
  compile 'org.apmem.tools:layouts:1.10@aar'
  compile 'com.github.TheBrownArrow:PermissionManager:1.0.0'
  compile 'com.google.code.gson:gson:2.7'
  compile 'com.squareup.picasso:picasso:2.5.2'
  compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
  compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
  compile 'com.splunk.mint:mint:5.0.0'
  compile 'com.facebook.android:facebook-android-sdk:4.6.0'
  compile 'com.google.android.gms:play-services-plus:11.0.4'
  compile 'com.google.android.gms:play-services-auth:10.0.1'
  compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
  compile 'com.github.robertsimoes:Shareable:0.1.0'

  testCompile 'junit:junit:4.12'
}
1 Answers

use same version of play-services dependencies

compile 'com.google.android.gms:play-services-plus:11.0.4'
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile "com.google.android.gms:play-services-ads:11.0.4'
Related