I am new in Android. i am currently working in android app and when i try to run the app this error occurs.
I have researched but cant solve this error.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
multiDexEnabled true
applicationId "com.tutorialsbuzz.androidfacebook"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
}
thankyou in advance
The reason behind that may be you have include two different versions for gms. Also if you have included the complete package then there is no need to include the second 'compile 'com.google.android.gms:play-services:7.5.0'' If you need only auth services from google then dont include the complete package it ll exceed 65k methods and duplicacy chances will be there. Include this
compile 'com.google.android.gms:play-services-auth:9.4.0'
and from your code remove
compile 'com.google.android.gms:play-services-auth:9.2.1' compile 'com.google.android.gms:play-services:7.5.0'
Execute it and let me know once.
In my case, it's because of the
compile 'com.facebook.android:audience-network-sdk:4.+'
I change it to this:
compile ('com.facebook.android:audience-network-sdk:4.+'){
exclude group:"com.google.android.gms"
}
No more problem!
If you are using Firebase, you should read my solution. In my case I developed a new app. This new app has ads, so I put compile 'com.google.firebase:firebase-ads:11.0.4'
BEFORE compile 'com.google.firebase:firebase-core:11.0.4'
.
But either you have to put everything AFTER firebase-core
or it's about the version number 11.0.4
that have to be the same on all firebase modules you are using.
Excluding com.google.android.gms
from the offending package worked to build the project for me, but unfortunately the app would crash during initialization. The solution for me was to upgrade all firebase
dependencies from 11.6.0
to 11.8.0
, ie:
- compile "com.google.android.gms:play-services-base:11.6.0"
- compile "com.google.firebase:firebase-core:11.6.0"
- compile "com.google.firebase:firebase-messaging:11.6.0"
- compile "com.google.firebase:firebase-analytics:11.6.0"
- compile "com.google.firebase:firebase-ads:11.6.0"
+ compile "com.google.android.gms:play-services-base:11.8.0"
+ compile "com.google.firebase:firebase-core:11.8.0"
+ compile "com.google.firebase:firebase-messaging:11.8.0"
+ compile "com.google.firebase:firebase-analytics:11.8.0"
+ compile "com.google.firebase:firebase-ads:11.8.0"
The problem was only presenting itself when adding firebase-ads
but this fixed it.
Please be sure that you are using identical versions of com.google.gms
.
You can run the next command from the project root dir to find out which versions are used:
./gradlew :<subproject>:dependencies
Usually it is something like this:
./gradlew :app:dependencies
After analyzing you are able to set the same versions or exclude
group from some modules or expose a version
来源:https://stackoverflow.com/questions/39490131/java-util-zip-zipexception-duplicate-entry-com-google-android-gms-internal-zzb