android.view.InflateException: Binary XML file line #12: Error inflating class

后端 未结 30 2407
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 13:48

I am receiving many errors of kind displayed in the subj. These errors seems to be occasional and I cannot reproduce them. From stack I can learn that such error may occurs

30条回答
  •  我在风中等你
    2020-11-22 14:51

    I know this thread is old, but still answering it so that no-one else should spend sleepless nights.

    I was refactoring an old project, whose layout files all contained hardcoded attributes such as android:maxLength = 500. So I decided to register it in my res/dimen file as 500.

    Finished refactoring almost 30 layout files with my res-value. Guess what? the next time I ran my project it started throwing the same InflateException.

    As a solution, needed to redo my all changes and keep all-those values as same as before.

    TLDR;

    step 1: All running good.

    step 2: To boost my maintenance I replaced android:maxLength = 500 with 500 and android:maxLength = @dimen/max_length , that's where it all went wrong(crashing with InflateException).

    step 3: All running bad

    step 4: Re-do all my work by again replacing android:maxLength = @dimen/max_length with android:maxLength = 500.Everything got fixed.

    step 5: All running good.

提交回复
热议问题