Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic Execution failed for task ':app:transformClassesWithDesugarForRelease'

I get this error when I try to build Android on my laptop and in Ionic's Pro dashboard.

[04:27:55]: ▸ FAILURE: Build failed with an exception.
[04:27:55]: ▸ * What went wrong:
[04:27:55]: ▸ Execution failed for task ':app:transformClassesWithDesugarForRelease'.
[04:27:55]: ▸ > com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {--input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/43.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/45.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/49.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/51.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/37.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/39.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/3.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/5.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/28.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/30.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/47.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/49.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/19.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/21.jar --input /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/44.jar --output /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/desugar/release/46.jar --classpath_entry /builds/user/anonymous-social/platforms/android/CordovaLib/build/intermediates/intermediate-jars/release/classes.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/classes/release --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/0.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/1.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/2.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/3.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/4.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/5.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/6.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/7.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/8.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/9.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/10.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/11.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/12.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/13.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/14.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/15.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/16.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/17.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/18.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/19.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/20.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/21.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/22.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/23.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/24.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/25.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/26.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/27.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/28.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/29.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/30.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/31.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/32.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/33.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/34.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/35.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/36.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/37.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/38.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/39.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/40.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/41.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/42.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/43.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/44.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/45.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/46.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/47.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/48.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/49.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/50.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/51.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/52.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/53.jar --classpath_entry /builds/user/anonymous-social/platforms/android/app/build/intermediates/transforms/stackFramesFixer/release/54.jar --bootclasspath_entry /opt/android-sdk/platforms/android-27/android.jar --bootclasspath_entry /opt/android-sdk/platforms/android-27/optional/org.apache.http.legacy.jar --bootclasspath_entry /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar --bootclasspath_entry /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar --bootclasspath_entry /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar --bootclasspath_entry /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar --bootclasspath_entry /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar --min_sdk_version 19 --nodesugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}

For the entire build details I made a pastebin: https://pastebin.com/QmJ6Tee3

I noticed that if I go into Platforms > android > project.properties my details are:

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=cordova-android-firebase-gradle-release/bemochi-cordova-android-firebase-gradle-release.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.2=cordova-plugin-firebase/bemochi-build.gradle
cordova.system.library.2=com.google.gms:google-services:+
cordova.system.library.3=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.4=com.google.firebase:firebase-core:+
cordova.system.library.5=com.google.firebase:firebase-messaging:+
cordova.system.library.6=com.google.firebase:firebase-crash:+
cordova.system.library.7=com.google.firebase:firebase-config:+
cordova.system.library.8=com.google.firebase:firebase-perf:+
cordova.system.library.9=com.google.android.gms:play-services-analytics:16.0.3
cordova.system.library.10=com.google.android.gms:play-services-location:15.+
cordova.system.library.11=com.android.support:support-v4:26.+
cordova.system.library.12=com.android.support:appcompat-v7:26.+
cordova.gradle.include.3=me.tonny.cordova.plugins.multidex/bemochi-build.gradle

I'm not sure what I'm doing wrong.

I'm not sure if this helps, but my build.gradle has this section:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="27.0.1" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
    }
}

I also read that when you have this problem you can use 2 plugins to fix it, but they're clearly not working for me (config.xml):

<plugin name="cordova-android-support-gradle-release" spec="1.4.7">
    <variable name="ANDROID_SUPPORT_VERSION" value="15.+" />
</plugin>
<plugin name="cordova-android-firebase-gradle-release" spec="^2.0.0">
    <variable name="FIREBASE_VERSION" value="15.+" />
</plugin>

My guess is there is an issue with Firebase and Google services versions but I'm not entirely sure... I've tried multiple versions and I can't seem to figure it out.

Any ideas?

like image 590
Simon Avatar asked Nov 12 '18 03:11

Simon


2 Answers

I solved the problem. There was a conflict with my cordova-plugin-firebase and cordova-plugin-google-analytics so what I ended up having to do was downgrade cordova-plugin-google-analytics to version 1.8.3 which ended up working for me.

Simple fix in the end but absolutely 0 indication from the error log that this might be the problem. Very frustrating.

like image 124
Simon Avatar answered Oct 26 '22 16:10

Simon


What you have to do:

  1. Delete the Platform folder from your project.
  2. Open your ionic project with android studio

Now run the following commands in an android studio:

ionic Cordova build then it asks for android and ios then type Android

Feel free to comment for more help :)

like image 20
Harry Avatar answered Oct 26 '22 16:10

Harry