0

I am developing cordova plugins for android based on android libraries and components. In many of my adaptations I encountered the Inflation exception error in many of them.

I created many issues regarding this here is my last one : https://github.com/wdullaer/MaterialDateTimePicker/issues/524

These exceptions don't come out when I use the library inside a native android studio app. Here I am asking about the potential reasons for this kind of error to emerge from a Cordova plugin

Kaki Master Of Time
  • 1,428
  • 1
  • 21
  • 39
  • Possible duplicate of [android.view.InflateException: Binary XML file: Error inflating class fragment](https://stackoverflow.com/questions/19874882/android-view-inflateexception-binary-xml-file-error-inflating-class-fragment) – Martin Zeitler Sep 16 '18 at 00:11
  • the issue on Github lacks the reference to the layout which is being inflated there. it's certainly one of them https://github.com/wdullaer/MaterialDateTimePicker/tree/master/library/src/main/res/layout (but no clue which one it is). – Martin Zeitler Sep 16 '18 at 00:12
  • @MartinZeitler The problem is that this is not my edited Layout. This is the one coming with a library, that when used with an android studio project does work fine. and I am using the same API and SDK and everything. – Kaki Master Of Time Sep 17 '18 at 18:02

1 Answers1

2

you could git clone https://github.com/wdullaer/MaterialDateTimePicker.git

and then add that project as a dependency, with fixed layout mdtp_daypicker_group.xml -

or even fork it, fix the layout/styles and then create a pull request (to have it fixed in their repository).

android:background="?attr/selectableItemBackgroundBorderless"

most likely should be:

android:background="?android:attr/selectableItemBackgroundBorderless"

but then it complains:

?android:attr/selectableItemBackgroundBorderless requires API level 21 (current min is 14)

you'd either have add this style res/values-v16/styles.xml and possibly up until API level 19 (or even up until 28, in one does not want to use those resources) - or set the minSdkLevel to 21.

adding selectableItemBackgroundBorderless into res/values/styles.xml should also make the layout work (without the android: prefix), because this would declare the style for all API levels ...while not using any Android SDK resources.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216