How to solve android java.util.zip.ZipException error for google gms

android Nov 05, 2016

Hello everybody, I have some problem to run my application in my phone and generate APK file but don’t have problem gradle build, why?

I have this error and search google to solve this, but unfortunately solution cannot solve my problem.

android java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzahn.class

I found solve my problem in Stack Overflow which so lucky from me

My problem from add some library in dependency with google play because my application use google map and authenticate with google sign-in then I comment out for similar and call 1 for all google play service to solve my problem successfully.

compile 'com.google.android.gms:play-services:9.8.0'
//compile 'com.google.android.gms:play-services-basement:9.8.0'
//compile 'com.google.android.gms:play-services-maps:9.8.0'
//compile 'com.google.android.gms:play-services-auth:9.8.0'

before that I have problem with multidex, add this in gradle

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

and add the MultiDexApplication class from the multidex support library to the application element in manifest file.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

Tags

Minseo Chayabanjonglerd

Android Developer ผู้เป็นเจ้าของบล็อก MikkiPastel ที่ชอบทำหลายๆอย่างนอกจากเขียนแอพแอนดรอยด์ เช่น เขียนบล็อก เขียนแชทบอท เรียนออนไลน์ อ่านหนังสือ วาดรูปเล่น ดู netfilx สั่งอาหารอร่อยๆกัน เป็นต้น

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.