pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 584 forks source link

ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings #197

Closed rishabhmathur1693 closed 6 years ago

rishabhmathur1693 commented 6 years ago

I'm getting these two errors while compiling for the Android platform -

  1. ERROR: In FontFamilyFont, unable to find attribute android:fontVariationSettings
  2. ERROR: In FontFamilyFont, unable to find attribute android:ttcIndex

Can anyone please help me figure out why this could be happening?

When I remove this plugin, build process succeeds.

aamatte commented 6 years ago

The same error is happening to me. Apparently, a new version of the com.android.support:support-v4 library was released, and the plugin defines com.android.support:support-v4:+ as framework 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. The problem may be solved specifying at least a major version (com.android.support:support-v4:27.+) instead.

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. After that, I executed ionic cordova platform remove android and ionic cordova platform add android.

rishabhmathur1693 commented 6 years ago

Thank you so much @aamatte . You really saved me today. I've spent whole night researching this issue.

PRINCEHR commented 6 years ago

plugin.xml can be found in platforms-->android-->project.properties

This will help to find xml file to remove that error

nemexis commented 6 years ago

Is not necessary to remove and add the android platform... just rebuild with --clean , after changing the com.android.support:support-v4:+ to com.android.support:support-v4:27.+ . in the project.properties file as described before by aamatte .

rdanieli commented 6 years ago

I'd like to inform that to me only worked when I removed and added it again.

robindierckx commented 6 years ago

Same issue, but the workaround does not work.

My platforms-->android-->project.properties is generated automatically by gradle and looks like this:

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-crosswalk-webview/creo2storetablet994666-xwalk.gradle
cordova.system.library.2=com.google.android.gms:play-services-analytics:+
cordova.gradle.include.2=cordova-plugin-ignore-lint-translation/creo2storetablet994666-build-extras.gradle

As you can see com.android.support:support-v4:24.1.1+ is asked to be installed (i.e., not v28).

However, after running ionic cordova build android I see in a build file /platforms/android/build/intermediates/blame/res/armv7/debug/multi/values-af.json: that com.android.support:support-v4:28 seems to be installed:

   34                  "from": {
   35:                     "file": "/my-app/platforms/android/build/intermediates/exploded-aar/com.android.support/coordinatorlayout/**28.0.0-alpha1**/res/values/values.xml",
   36                      "position": {
   37                          "startLine": 2,
   ..
  318                  },

The issue persist when removing android, and even after completely resetting and reinstalling the whole repo.

Any idea why the specification in project.properties is ignored, and how to avoid installation of com.android.support:support-v4 version 28.0.0-alpha1 ?

robindierckx commented 6 years ago

Ok, my problem is solved when uninstalling the crosswalk plugin (that i needed for older devices)

richardshergold commented 6 years ago

@robindierckx I am getting this error in an Ionic project too - what did you do, just change the project.properties file as per the earlier comments? I don't understand because that file then disappears when you uninstall the android platform and add it again?

robindierckx commented 6 years ago

@richardshergold You are right. The project.properties file is generated by /platforms/android/cordova/lib/builders/GradleBuilder.js, which is erased when uninstalling the platform. If you don't uninstall the platform though, you can modify your project.properties file searching for com.android.support in GradleBuilder.js, change the version, and then rebuild with --clean.

In my case the version in project.properties was still ok, and the issue came from the fact that for some reason the crosswalk plugin pulled the buggy version of com.android.support:support-v4. Removing crosswalk reverted that plugin to an earlier version and removed the bug.

PS: In fact, I don't even have the cordova-plugin-file-opener2 plugin... So this is a more general cordova bug appearing in many plugins.

sreekanth-karini commented 6 years ago

Install this plugin to fix this issue. ionic cordova plugin add cordova-android-support-gradle-release --save https://github.com/dpa99c/cordova-android-support-gradle-release

hemantdhivar commented 6 years ago

thanks sreekanth, this works for me

gabrielfreire commented 6 years ago

My problem was crosswalk-webview plugin my project.properties was automatically set to com.android.support:support-v4:24.1.1+ and it works fine after removing crosswalk-webview.

gsoulie commented 6 years ago

Still KO for me...2 days ago my project built fine, and since this morning without touch anything, build is KO with this error. crosswalk-webview plugin is not installed in my project, i tried all the solutions mentioned here and nothing works... I don't understand... Changing to com.android.support:support-v4:24.1.1+ don't do anything

[EDIT] I finally found the solution ! I work with Ionic framework, so the solution was to do this : cordova plugin rm cordova-plugin-compat --force cordova platform rm android ionic cordova platform add android@6.3.0

According to that topic : android-build-broken-after-gradle-dependencies-update

appted commented 6 years ago

Same Situation here like gsoulie said.

ghost commented 6 years ago

Same error fixed

plaforms/android/project.properties

file fixed.

before

...
...
cordova.system.library.2=com.android.support:support-v4:+

after

...
...
cordova.system.library.2=com.android.support:support-v4:27.1.0

@aamatte thx

jkhax0r commented 6 years ago

I had to go to v4:26.+ for some reason to make it work. Doing 'cordova platform add android@6.3.0' worked too but seemed like a bigger change

ograndebe commented 6 years ago

I'm using crosswalk plugin, and i solved the problem only by using of @sreekanth-karini tip. running command cordova plugin add cordova-android-support-gradle-release --save

I'm not using ionic.

williamtran1988 commented 6 years ago

cordova plugin add cordova-android-support-gradle-release --save it does not help. Issue is still existing.

S-K-Lieren commented 5 years ago

For me, it works with cordova-android version 6.3.0.

ionic cordova platform remove android --save and ionic cordova platform add android@6.3.0 --save.

aamirmirza2999 commented 5 years ago

when i import this library compile 'com.facebook.android:facebook-core:4.36.1' compile 'com.facebook.android:facebook-marketing:4.36.1' after gradle procces when i run found an error

ERROR: In FontFamilyFont, unable to find attribute android:font ERROR: In FontFamilyFont, unable to find attribute android:fontStyle ERROR: In FontFamilyFont, unable to find attribute android:fontWeight

uriklar commented 5 years ago

I was running into this issue with react native and it was caused by the following lines in my android/app/build.gradle:

implementation ("com.google.android.gms:play-services-base:+") {
  force = true;
}
implementation ("com.google.android.gms:play-services-maps:+") {
  force = true;
}

etc...

Apparently this + resolved to a new 17.0.0 version which broke my build.
Changing the + to 16.0.0 (or 16.0.1 for play-services-base) solved my issue