Search code examples
androidcordovacordova-plugins

Inflation Exceptions when developping Cordova


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


Solution

  • 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.