Impossible to build app ionic on android

2020-02-16 04:20发布

问题:

I've been working on a project with ionic from a long time.

Recently i updated android studio and it's packages and now i can't build on android anymore because of the following issue:

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzc.class

Before updating android studio everything worked well.

This is a ionic v1 app with cordova android engine 6.1.2.

I'm using cordova 6.5.0, ionic 2.2.1.

My android environment: sdk tools 25.2.3, sdk platform tools 26, sdk build tools 26

Do you have any idea why i keep getting this error when compiling?

回答1:

That error is being caused by conflicting versions of the Play Services library being requested by different plugins.

Quickest way to fix is to install cordova-android-play-services-gradle-release into your Cordova project which will force Gradle to align the versions:

cordova plugin add cordova-android-play-services-gradle-release