Error with Ionic App: execution failed for task ': transformClassesWithJarMergingForDebug'

I checked all posts talking about this error:

Failed for task ': transformClassesWithJarMergingForDebug'

But none of them corresponds exactly to my case, and none of them answered / did not solve my problem ... I was tired of the search (about 12 hours and did not find anything ...)

Explaination

I am using Ionic (latest version) to create an application. My first problem was related to the SenderID problem: I can’t put it in the init function, but when I deleted it, it didn’t work on Android ... And when I said that, it said that it could not be assigned PushOptions , you see trick.

Actual error

The actual error that I have is the following:

Execution failed for task ': transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org / apache / cordova / BuildHelper.class

Here is what I did to be here:

Actions

So, I decided to switch to cordova-plugin-fcm , as I see in different places, that it is easy to configure. Go through it, generate all the necessary files ( google-services.json , etc.), Install and run all the TS that the plugin needs: there are no TS errors.

My problem: when I run ionic cordova run android - or just build, the same thing - I had problems with multiple values:

First mistake

At first I had a problem with the game services, which is unknown, so it will go through version 9.0.0: I decided to use it using cordova-plugin-firebase and cordova-android-play-services-gradle-release .

Second mistake

Secondly, I had this one:

Execution failed for task ': transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org / apache / cordova / PermissionHelper.class

What I decided with:

 cordova plugin rm cordova-plugin-compat --force cordova plugin add cordova-plugin-compat@1.2 

But now I am stuck in a "Real Error" and could not create my application.

Stack

Cordoba Plugins:

 cordova-android-play-services-gradle-release 1.1.3 "cordova-android-play-services-gradle-release" cordova-plugin-app-version 0.1.9 "AppVersion" cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-console 1.0.5 "Console" cordova-plugin-device 1.1.4 "Device" cordova-plugin-firebase 0.1.24 "Google Firebase Plugin" cordova-plugin-multidex 0.1.2 "Cordova Multi Dex" cordova-plugin-splashscreen 4.0.2 "Splashscreen" cordova-plugin-statusbar 2.2.1 "StatusBar" cordova-plugin-whitelist 1.3.1 "Whitelist" ionic-plugin-keyboard 2.2.1 "Keyboard" 
+5
source share
1 answer

Here is what I did to get rid of this problem:

  • Remove your platforms:
  ionic cordova platform remove ios
 ionic cordova platform remove android
  • Delete the following directories in your application:
  \ platforms
 \ plugins
  • add your platforms:
  ionic cordova platform add ios
 ionic cordova platform add android

After that you can rebuild the application and it should work

+12
source

Source: https://habr.com/ru/post/1273009/


All Articles