After adding Push Plugin ionic cordova build android fails

Hello after I added the Codrova-Push-Plugin I can’t build my app as apk anymore.
I’ve also added these two lines in my project.properties:
cordova.system.library.1=com.google.android.gms:play-services-auth:10.0.1
cordova.system.library.2=com.google.android.gms:play-services-identity:10.0.1

I have API 25 of Android installed.
Ionic info:
global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 browser 4.1.0
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.9.1
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.8

This is my build log:

Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser

[16:39:59] build dev started …
[16:39:59] clean started …
[16:39:59] clean finished in 7 ms
[16:39:59] copy started …
[16:39:59] transpile started …
[16:40:09] transpile finished in 10.27 s
[16:40:09] preprocess started …
[16:40:09] deeplinks started …
[16:40:09] deeplinks finished in 80 ms
[16:40:09] preprocess finished in 82 ms
[16:40:09] webpack started …
[16:40:16] copy finished in 17.12 s
[16:40:28] webpack finished in 18.54 s
[16:40:28] sass started …
[16:40:30] sass finished in 2.10 s
[16:40:30] postprocess started …
[16:40:30] postprocess finished in 12 ms
[16:40:30] lint started …
[16:40:30] build dev finished in 31.07 s

cordova build android
\ Running command [16:40:36] lint finished in 5.68 s
:heavy_multiplication_x: Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

(truncated) ... ibsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:prepareComAndroidSupportSupportCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2520Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2520Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportV132510Library UP-TO-DATE
:prepareComAndroidSupportSupportV42520Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAuth1001Library
:prepareComGoogleAndroidGmsPlayServicesAuthBase1001Library
:prepareComGoogleAndroidGmsPlayServicesBase1001Library
:prepareComGoogleAndroidGmsPlayServicesBasement1101Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesIdentity1001Library
:prepareComGoogleAndroidGmsPlayServicesTasks1101Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseAnalytics1001Library
:prepareComGoogleFirebaseFirebaseAnalyticsImpl1001Library
:prepareComGoogleFirebaseFirebaseCommon1101Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCore1001Library
:prepareComGoogleFirebaseFirebaseIid1101Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseMessaging1101Library UP-TO-DATE
:prepareMeLeolinShortcutBadger1114Library UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib623DebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:processDebugGoogleServices
Parsing json file: C:\DEv\MobileProject\BarOn\IonicApplication\platforms\android\google-services.json
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets
:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zzf.class

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 56.858 secs
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zzf.class

Could you please help me out of this ;(

This was talked about several times in the forum. Search for [quote=“marcel_wolf, post:1, topic:97640”]
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zzf.class
[/quote]

or[quote=“marcel_wolf, post:1, topic:97640”]
transformClassesWithJarMergingForDebug
[/quote]

should give you some results.

Oh I tried several search keywords -> I couldn’t find a thread suitable for me. I will try again. Thank you

I also tried to add this lines in my build.gradle file:
multiDexEnabled true

configurations {
all*.exclude group: ‘com.android.support’, module: ‘support-v4’
}

But then I get another error

I think that one was for a different problem.

Adding this lines to my project.properties solved my Problem:
cordova.system.library.1=com.google.android.gms:play-services-auth:11.0.2
cordova.system.library.2=com.google.android.gms:play-services-identity:11.0.2

1 Like

Can you please explain how you came about your solution. I have a similar problem with my app.

Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportCustomtabs2400Library UP-TO-DATE
:preDebugAndroidTestBuild UP-TO-DATE
:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:prepareComAndroidSupportSupportCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2520Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2520Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportV42520Library UP-TO-DATE
:prepareComCrashlyticsSdkAndroidAnswersShim006Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAdsLite1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAppindexing980Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesClearcut1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesDrive1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGames1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGass1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGcm1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesIid1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesLocation1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesPlus1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesSafetynet1104Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1104Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCommon980Library UP-TO-DATE
:prepareComOnesignalOneSignal357Library UP-TO-DATE
:prepareIoBranchSdkAndroidLibrary2103Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzng.class

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

I read this solution in a Github-Issue regarding build errors after adding Push-Plugin. After that I had a closer look into my Android SDK Folder:(%USER%/AppData\Local\Android\sdk\extras\google\m2repository\com\google\android\gms\play-services) where I saw my newest google-play-service installation is 11.0.2.