Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex android android

Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex


Just put following in build-extras.gradle

configurations.all {    resolutionStrategy {        force 'com.android.support:support-v4:27.1.0'    }}


Google released the new version 28.0.0-alpha1 of com.android.support:support-v4 which is adding 2 new attributes(android:fontVariationSettings and android:ttcIndex).Some of the plugins are using the latest android-support libraries which results in unwanted incompatibilities.

Option 1:Install cordova-android-support-gradle-release plugin.

Well documented plugin which "aligns various versions of the Android Support libraries specified by other plugins to a specific version". Tested without any destructive behavior.

cordova plugin add cordova-android-support-gradle-release --fetch

Read the documentation for a full set of options: Readme

Option 2:Add next code snippet in build.gradle under platforms/android

/** IMPORTANT - Manually addedProblem: 8 March 2018 - Google released version support-v4:28.0.0-alpha1 which breaks the project with following error: unable to find attribute android:fontVariationSettings and android:ttcIndexEffect: Force a specific version of the library*/configurations.all {    resolutionStrategy.force 'com.android.support:support-v4:27.1.0'}

Warning: code in build.gradle will be overwritten if you remove/add the Android platform. If you don't want to use the plugin for some reason or somehow is not working for you, instead create a hook and overwrite the file every time. Check 2nd comment here.

If the problem is persistent you may try:

cordova platform rm androidcordova platform add android

OR

Make sure you don't have a previous version of the app installed on the device you test because you'll receive an ambiguous error when it tries to downgrade the existing version: "INSTALL_FAILED_VERSION_DOWNGRADE" and "UnhandledPromiseRejectionWarning: Unhandled promise rejection"


The same error is happening to me. Apparently, a new version of the com.android.support:support-v4 library was released, and the plugin I'm using defines com.android.support:support-v4:+ as dependency in plugin.xml. The + sign means that it will get the latest version (28.0.0), which seems seems to be incompatible with other plugins.

I was able to build a development version by changing all the plugin dependencies from com.android.support:support-v4:+ to com.android.support:support-v4:27.1.0. Also, I executed ionic cordova platform remove android and ionic cordova platform add android. Hope it helps, at least for development.