Cordova build fails due to "com.android.support:support-v4" version
prudnikovdbison opened this issue ยท 7 comments
Cordova build fails with exception:
:processDebugResourcesERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
This can be fixed in plugin.xml by upgrading
<framework src="com.android.support:support-v4:+" />
to a higher version like 27.0.1 or downgrading to 23.+.
Examples (tested):
<framework src="com.android.support:support-v4:27.0.1" />
or
<framework src="com.android.support:support-v4:23.+" />
Same here. Simply adding the plugin in my ionic project without even importing nor using it.
cordova plugin remove cordova-plugin-file-opener2
didn't fix, even tho i removed the plugin with this command.
I ran cordova clean
and finally got rid of whatever was causing problems, this is the output:
Android Studio project detected
ANDROID_HOME=C:\android_sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_131
Subproject Path: CordovaLib
Subproject Path: app
> Configure project :CordovaLib
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_bjcqxndxlo2btrsrtx6k8ypbs.run(C:\Users\Fil\****\Projects\Mobile\Ionic\APOD_nasa\platforms\android\app\build.gradle:144)
Use this cordova plugin to fix this problem
I forced version 27.0.0 and it works flawlessy:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.0.0
I don't know what happened but i managed to build even though i didn't touch my project. I think this is some kind of compatibility-issue and not a real bug - i'm happily using the plugin without any error now!
@roby65 That only solves half of the issue. Using that plugin keep crashes the app on launch. Only way to get it working is running via Android Studio.
Proper way to solve this is seen on this answer on stack.
Create a build-extras.gradle
file in platforms/android
and add the following in that file. This forces all framework sources to use v4:27.1.0
of support files.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
I tried every suggestion to fix this but in the end simply updating ionic and cordova fixed it:
npm install -g ionic cordova
You might also need to remove and add the Android platform again:
ionic cordova platform rm android
ionic cordova platform add android
cordova-android-support-gradle-release and build-extras.gradle conflicts with other plugins. Better not install this plugin.
version 2.1.0 should now resolve this issue as you can optionally set a compatible android_support_version at installation time, e.g.
cordova plugin add cordova-plugin-file-opener2 --variable ANDROID_SUPPORT_VERSION=27.+