I get an error when building my Ionic app, that I didn't used to get


#1

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

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> 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 

I haven’t updated any of my plugins/config/platform files since I did my last successful build.

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

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=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.+

And if I change them all to + instead of a number, than I get another error: Execution failed for task ':app:processDebugResources'.

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="25.0.2" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=26 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=26 //Integer - We ALWAYS compile with the latest by default
    }
}

Could there be an issue there? I really don’t know what the problem is… Any ideas? I’ve been trying to solve for 4 days, looking at all the SO and Ionic posts but nothing has helped.


#2

@SimonKomlos

Check this link


#3

Try with removing platform and adding again


#4

I’ve tried this already with no success


#5

Yeah I’ve already tried cordova clean android with no results.


#6

Try to add an older version
cordova platform add android@6.4.0
see if this fixes the problem.


#7

@SimonKomlos can you share your enviornment info?


#8
$ ionic info
√ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)  : 4.1.2 (C:\Users\Simon K\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : not installed
   Cordova Platforms     : android 7.1.2, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (C:\Users\Simon K\AppData\Local\Android\Sdk)
   NodeJS            : v8.11.2 (C:\Program Files\nodejs\node.exe)
   npm               : 2.15.12
   OS                : Windows 10

I’m not sure why it says Cordova CLI is not installed… I’m pretty sure it is. Could this be the issue? It doesn’t work on Ionic Pro either though


#9

Try reinstalling cordova


#10

@mathewk, @NikolaDrangovski neither of these worked for me unfortunately. It’s such a strange issue. I didn’t change my files at all from the last time I had a successful build, but now it won’t work.


#11

I fixed it!!!

What ended up working for me was changing my project.properties to:

target=android-26 android.library.reference.1=CordovaLib cordova.gradle.include.1=cordova-plugin-firebase/bemochi-build.gradle cordova.system.library.2=com.google.gms:google-services:4.1.0 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:+ cordova.system.library.10=com.google.android.gms:play-services-location:+ cordova.system.library.11=com.android.support:support-v4:26.1.0 cordova.system.library.12=com.android.support:appcompat-v7:26.1.0

and

this answer on StackOverflow was VERY IMPORTANT: https://stackoverflow.com/questions/49208772/error-resource-androidattr-fontvariationsettings-not-found