Error inflating class androidx.constraintlayout.ConstraintLayout after migration to androidx

后端 未结 17 1255
[愿得一人]
[愿得一人] 2020-11-27 14:24

I just made a migration to androidx through Android Studio menu option Refactor -> Refactor to AndroidX

I\'m getting the following

17条回答
  •  北海茫月
    2020-11-27 15:04

    I has same issue after:

    • migration support library to androidx;
    • increment targetSdkVesrsion to 29;

    I also use:

    implementation "uk.co.chrisjenx:calligraphy:2.3.0"
    

    I tried all posts from this question, but none success.

    I fix it by adding one string .disableCustomViewInflation() to Calligraphy init:

    @Override
    public void onCreate() {
    
        super.onCreate();
        // ...
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath("fonts/Sans-Regular.ttf")
                .setFontAttrId(R.attr.fontPath)
                .disableCustomViewInflation() // <----- this fix
                .build());
        // ...
    }
    

    I hope next release of Calligraphy (Christopher Jenkins thanks for your great job) will fix it inside too.

提交回复
热议问题