Calligraphy
Calligraphy copied to clipboard
Android application crashes for calligraphy library for Android Q
Hey @chrisjenx , I am using your calligraphy library for my app and seems like it crashes right on app launch for Android Q. I have seen other people complain about this lately aswell. I have the latest version of your lib 2.3.0 and still face this issue. Any update if you are aware of this or if I need to do anything on my end to sort this out? Here's the 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)
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
You mean use this : implementation 'io.github.inflationx:calligraphy3:3.1.1',replace :compile 'uk.co.chrisjenx:calligraphy:2.3.0' ?
is it backwards compatible though? the new viewpump crashes for previous OS version (P and below.
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
ViewPump is a very small migration, also as deps are transitive, you only need to follow the setup for Calligraphy 3 Setup.
There are many changes to make this injector valid, you would literally need to backport ViewPump back to this - it's much less work to move to VP.
migrate to Calligraphy 3
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
ViewPump is a very small migration, also as deps are transitive, you only need to follow the setup for Calligraphy 3 Setup.
There are many changes to make this injector valid, you would literally need to backport ViewPump back to this - it's much less work to move to VP.
What about the crash that older target sdk version apps are facing, if they update to Calligraphy 3 ? Looks like some other Calligraphy library will be needed, because you are not providing a backwards compatible solution.
@chrisjenx Please use https://www.xda-developers.com/android-development-bypass-hidden-api-restrictions/ article to by pass reflection api restrictions by google, so that your library can be used for backwards compatibility.
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
ViewPump is a very small migration, also as deps are transitive, you only need to follow the setup for Calligraphy 3 Setup. There are many changes to make this injector valid, you would literally need to backport ViewPump back to this - it's much less work to move to VP.
What about the crash that older target sdk version apps are facing, if they update to Calligraphy 3 ? Looks like some other Calligraphy library will be needed, because you are not providing a backwards compatible solution.
@chrisjenx Please use https://www.xda-developers.com/android-development-bypass-hidden-api-restrictions/ article to by pass reflection api restrictions by google, so that your library can be used for backwards compatibility.
It's not an api restriction issue, the implementation on Q+ is different (to the point the hack isn't really needed on Q+). Support here is dead, we're not going to maintain two libraries that do the same thing, so as people have mentioned multiple times, move to Calligraphy 3 - it is a fairly trivial change and gives you much more flexibility going forwards.
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
ViewPump is a very small migration, also as deps are transitive, you only need to follow the setup for Calligraphy 3 Setup. There are many changes to make this injector valid, you would literally need to backport ViewPump back to this - it's much less work to move to VP.
What about the crash that older target sdk version apps are facing, if they update to Calligraphy 3 ? Looks like some other Calligraphy library will be needed, because you are not providing a backwards compatible solution. @chrisjenx Please use https://www.xda-developers.com/android-development-bypass-hidden-api-restrictions/ article to by pass reflection api restrictions by google, so that your library can be used for backwards compatibility.
It's not an api restriction issue, the implementation on Q+ is different (to the point the hack isn't really needed on Q+). Support here is dead, we're not going to maintain two libraries that do the same thing, so as people have mentioned multiple times, move to Calligraphy 3 - it is a fairly trivial change and gives you much more flexibility going forwards.
What about the crash that older target sdk version apps are facing, if they update to Calligraphy 3?
What about the crash that older target sdk version apps are facing, if they update to Calligraphy 3?
No idea, but if it's problem still on ViewPump + Calligraphy 3 then we'll fix it over there. 👍
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/Roboto-Regular.ttf") .setFontAttrId(R.attr.fontPath) .disableCustomViewInflation() .build());
write this line ---- disableCustomViewInflation()
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/Roboto-Regular.ttf") .setFontAttrId(R.attr.fontPath) .disableCustomViewInflation() .build());
write this line ---- disableCustomViewInflation()
it helped me, thank you
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/Roboto-Regular.ttf") .setFontAttrId(R.attr.fontPath) .disableCustomViewInflation() .build());
write this line ---- disableCustomViewInflation()
you saved my day, thanks.
在 ViewPump 中已修复,我们解决了该问题,您需要升级到该问题。
@chrisjenx确切地需要进行哪些更改才能为使用此旧书法库的旧项目提供支持,而不是更改为 View pump,因为这对我们来说将是一个重大变化。
ViewPump 是一个非常小的迁移,而且由于 deps 是可传递的,您只需要按照 Calligraphy 3 Setup 的设置进行操作即可。
有很多改变可以使这个注入器有效,你实际上需要将 ViewPump 反向移植回这个——转移到 VP 的工作要少得多。
Fixed in ViewPump, we worked around the issue, you'll need to upgrade to that.
@chrisjenx exactly what changes are required to provide support for an old project where this old calligraphy library used, instead of changing to View pump, because that will be a major change for us.
ViewPump is a very small migration, also as deps are transitive, you only need to follow the setup for Calligraphy 3 Setup.
There are many changes to make this injector valid, you would literally need to backport ViewPump back to this - it's much less work to move to VP.
I try to ViewPump ,but Failed resolution of: Lio/github/inflationx/viewpump/ViewPump;