13

I have a calligraphy library I am using for custom fonts which seems to work on all versions except for android Q , where it crashes my app right on launch.Any one else has had to deal with the same issue lately? Here's my crash report :

Caused by: android.view.InflateException: Binary XML file line #17 in com.myapp.dev:layout/abc_screen_simple: Binary XML file line #17 in com.myapp.dev:layout/abc_screen_simple: Error inflating class android.support.v7.widget.FitWindowsLinearLayout
Caused by: android.view.InflateException: Binary XML file line #17 in commyapp.dev:layout/abc_screen_simple: Error inflating class android.support.v7.widget.FitWindowsLinearLayout
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
at uk.co.chrisjenx.calligraphy.ReflectionUtils.getValue(ReflectionUtils.java:29)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(CalligraphyLayoutInflater.java:203)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(CalligraphyLayoutInflater.java:20)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:302)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:239)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.inflate(LayoutInflater.java:659)
at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:631)
at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.myapp.dev.ui.splash.SplashActivity.onCreate(SplashActivity.java:36)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)

Please note, I do not use FitWindowsLinearLayout or abc_screen_simple in my code, it all comes from this lib. I have even updated to the latest version 2.3.0 :

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

but had no luck. I have even followed the answers on this thread : Crash on Android Q API 29 but no luck Any ideas how to go about this?

Thanks!

  • 1
    `Any ideas how to go about this?` i tell this to everyone who asks library related questions, but consider making an issue on their github too – a_local_nobody Aug 14 '19 at 13:10
  • I did too. no response yet, which is why I wanted to see if anyone else had a workaround or fixed this somehow –  Aug 14 '19 at 13:11
  • no problem, not hating on your question, just saying that the place you'll probably find an answer is from the creators :) hope you do find an answer though – a_local_nobody Aug 14 '19 at 13:13
  • Are you using this [library](https://github.com/InflationX/Calligraphy)? If so then check it dependency – Piyush Aug 14 '19 at 13:24

1 Answers1

25

Have you check the library mention that

This version of Calligraphy has reached its end-of-life and is no longer maintained. Please migrate to Calligraphy 3!

dependencies {
    implementation 'io.github.inflationx:calligraphy3:3.1.1'
    implementation 'io.github.inflationx:viewpump:2.0.3'
}

So I will suggest you use the latest one and you are not going to face the above issue. Because I am also using the same and there is no crash on API 29.

Sunny
  • 3,134
  • 1
  • 17
  • 31
  • I just did. didn't know about the migration. Need to test if its backward compatible aswell, but thanks for the link! it seems to be the only way out at this point. –  Aug 14 '19 at 14:06
  • it doesnt seem to be backward compatible, need to restrict it to q and above –  Aug 14 '19 at 14:14
  • It is backward compatible actually. Just used it with a custom font on both android Q and API 26, worked fine – riadrifai Sep 03 '20 at 22:14