Calligraphy
Calligraphy copied to clipboard
android.view.InflateException: Binary XML file line #0: Error inflating class android.widget.EditText
It happens to ZenFone 2 device, Android 5.0 Im using this lib version 2.3.0
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.myapp.modules.login.views.LoginActivity}: android.view.InflateException: Binary XML file line #0: Error inflating class android.widget.EditText at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:147) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5264) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) Caused by android.view.InflateException: Binary XML file line #0: Error inflating class android.widget.EditText at android.view.LayoutInflater.createView(LayoutInflater.java:633) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:164) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.onCreateView(CalligraphyLayoutInflater.java:148) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
Full stack trace is here: stacktrace.txt
Layout xml file of Login activity: activity_login.txt
I`m having the same issue..
It seems this library does not work well with TextInputLayout
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:theme="@style/TextAppearance.TextInputLayout.Login"
android:layout_marginBottom="@dimen/default_margin_3"
android:layout_marginStart="@dimen/default_margin_3"
android:layout_marginEnd="@dimen/default_margin_3"
android:gravity="bottom"
>
<EditText
android:id="@+id/usernameEditTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin_3"
android:textSize="16sp"
android:singleLine="true"
android:textColor="@color/colorGrey3"
android:hint="Username"
android:text="[email protected]"
android:inputType="textEmailAddress"
/>
</android.support.design.widget.TextInputLayout>
style.xml
<style name="TextAppearance.TextInputLayout.Login">
<item name="fontPath">fonts/font.ttf</item>
<item name="android:textColorHint">@color/colorAccent2</item>
<item name="colorAccent">@color/colorGrey4</item>
<item name="colorControlNormal">@color/colorGrey6</item>
<item name="colorControlActivated">@color/colorAccent2</item>
<item name="android:textSize">16sp</item>
</style>
If I remove the android:theme in TextInputLayout, the exception is gone.
Same issue but with Buttons.
android.view.InflateException: Binary XML file line #0: Error inflating class Button
Device: LG G3 Operating System: 4.4.2
`
Caused by android.content.res.Resources$NotFoundException
| android.content.res.Resources.loadDrawable (Resources.java:2136) | android.support.v7.app.AppCompatDelegateImplV9.onCreateView (Unknown Source) | uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$WrapperFactory2.onCreateView (Unknown Source) | android.view.LayoutInflater$FactoryMerger.onCreateView (LayoutInflater.java:172) | android.view.LayoutInflater.inflate (LayoutInflater.java:492) | uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate (Unknown Source) | android.view.LayoutInflater.inflate (LayoutInflater.java:397) | com.buildone.delivery.features.profile.DriverProfileFragment.onCreateView (Unknown Source) | android.support.v4.app.Fragment.performCreateView (Unknown Source) | dalvik.system.NativeStart.main (NativeStart.java)
Caused by org.xmlpull.v1.XmlPullParserException
| android.graphics.drawable.Drawable.createFromXmlInner (Drawable.java:933) | android.support.v7.app.AppCompatDelegateImplV9.onCreateView (Unknown Source) | uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$WrapperFactory2.onCreateView (Unknown Source) | android.view.LayoutInflater$FactoryMerger.onCreateView (LayoutInflater.java:172) | android.view.LayoutInflater.inflate (LayoutInflater.java:492) | uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate (Unknown Source) | android.view.LayoutInflater.inflate (LayoutInflater.java:397) | com.buildone.delivery.features.profile.DriverProfileFragment.onCreateView (Unknown Source) | android.support.v4.app.Fragment.performCreateView (Unknown Source) | dalvik.system.NativeStart.main (NativeStart.java)
EDIT: My problem was using vector drawables in android buttons. Not related to calligraphy.
Same issue with LG H810 Android 5.1
Same problem with LG k240h 6.0
I had the same bug, and cause by the attribute "BackgroundTint" in the Floating button view
I have same issue in SAMSUNG GLAXAY J5 .
same issue in android studio 3.0 OS 4.4.2
/AndroidRuntime: FATAL EXCEPTION: main Process: com.taggroup.www.darzeeco, PID: 3664 android.view.InflateException: Binary XML file line #0: Error inflating class ImageButton at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714) at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.taggroup.www.darzeeco.CustomerAct.CartAdapter.onCreateViewHolder(CartAdapter.java:42) at com.taggroup.www.darzeeco.CustomerAct.CartAdapter.onCreateViewHolder(CartAdapter.java:27) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3135) at android.view.View.measure(View.java:16497) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) at android.view.View.measure(View.java:16497) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1226) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.widget.ScrollView.onMeasure(ScrollView.java:326) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291) at android.view.View.measure(View.java:16497) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000) at android
Hi! guys i have this error when i run application in kitkat i know multidex and i enabled but error show
For Android Studio 3.0.1
I have got the same issue and I have resolved finally Opening the gradle.properties
and added following line:
android.enableAapt2=false
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
@techview51 you saved my life thank you!!!!
@sshahidaslamm your solution solved my problem!
@ariel179 You are welcome.
Same problem here but with Fragment.
@techview51 Copied and fixed, thank you so much!
@techview51 Thank you so much !
@techview51 thanks a ton mate 🗡
@TBaulos , @samk17cmutpm , @UnselfconsciousLux : You are welcome.
Also had the same ussue, I did what @techview51 said and it worked.
@techview51 thanks for solutions... very simple!
me: FATAL EXCEPTION: main
Process: com.example.ennie.miniproject, PID: 15398
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ennie.miniproject/com.example.ennie.miniproject.LoginActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class Button
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.ennie.miniproject.LoginActivity.onCreate(LoginActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6371)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class Button
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.ennie.miniproject.LoginActivity.onCreate(LoginActivity.java:26)
at android.app.Activity.performCreate(Activity.java:6371)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.ennie.miniproject:drawable/shape" (7f070077) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f070077 a=-1 r=0x7f070077}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2899)
at android.content.res.Resources.loadDrawable(Resources.java:2821)
at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
at android.view.View.
you need to change AppTheme @styles.xml like its really work
Interesting, appt2 shouldn't break this, we'll need to raise a bug report to see why it's doing it
I'm having the same issue. The Android drawable "res/drawable-v21/design_password_eye.xml" is not found when inflating TextInputLayout on some devices with Android Lollipop and higher. The same happens with "Calligraphy 3".
@sshahidaslamm i'll follow your answer but it's give me a new error android.view.InflateException: Binary XML file line #129: Error inflating class TextView. On Emulator it's work perfectly without using your answer but in my device give me a error
@techview51 Thanks bro..I complete my app successfully.Just Because of you.Again thanks bro.
@techview51 thanks dude..
@auzanassdq @sanjayajena37 @allexsv @georgetsiga You are welcome.
@techview51 thanks bro.....my problemis solve
@soheltanvir0699 You are welcome.
@techview51 Wasted 4 hours trying to solve the problem. The simple copy of image to drawable folder solved. But why does this work?
@techview51 Thanks.
@techview51 Are u a hero, sir ? , you just save my life !!!
In my case, I found that I shouldn't use attr / theme reference in color resource. For example, the following color resource caused the problem.
Problem
<color name="title">?attr/colorSpecial</color>
<style name="mytheme" parent="xyz">
<item name="colorAccent">@color/title</item>
</style>
Solution
Don't use attribute / theme colors directly in color resource that may or may not be in turn used in theme.
<color name="title">@color/colorSpecial</color>
<style name="mytheme" parent="xyz">
<item name="colorAccent">@color/title</item>
</style>
If you really need theme color (i.e. ?attr/xxx
), probably instead of regular color resource, you may need to define another color attribute in your theme.
@sshahidaslamm Thank you, you solved my problem
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
You saved my life :+1:
@rpattabi , You are right. Thanks.
Don't use attribute / theme colors directly in color resource that may or may not be in turn used in theme.
If you really need theme color (i.e. ?attr/xxx), probably instead of regular color resource, you may need to define another color attribute in your theme.
I am facing the issue in textInputLayout Password field
Resource not found exception Drawable drawable/design_password_eye with resource ID #0x7f080098
Please help me to solve this .
this is my build.gradle
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-core-ui:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
}
hi, all I have the same issue when i use (Android 6): On EditText:
- android:drawableStart
- android:background
And on RelativeLayout :
- android:background ... And when i copy resources from drawable-v24 to drawable it's work fine .
Thank's @techview51
@techview51 Wasted 4 hours trying to solve the problem. The simple copy of image to drawable folder solved. But why does this work?
I don't know exactly, just works ;)
@techview51 Thanks.
You are welcome.
@techview51 Are u a hero, sir ? , you just save my life !!!
Glad to hear that. Good luck.
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
You saved my life 👍
@JayTailor45 Glad to hear that. Good luck.
hi, all I have the same issue when i use (Android 6): On EditText:
- android:drawableStart
- android:background
And on RelativeLayout :
- android:background ... And when i copy resources from drawable-v24 to drawable it's work fine .
Thank's @techview51
You are welcome.
Caused by: android.view.InflateException: Binary XML file line #54: Binary XML file line #54: Error inflating class EditText
I was also getting the similar error, In my case I had added xml file's( icon) with drwable. By adding Normal png images solved the issue.
Adding xml files with drawable causes error many times, sometimes error does not come.
copied
In my case, no drawable 24 folder exist, nor values and layout.
in my case I do not have drawable-24 or 21 in the project
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
Thank you sir, it works fine you save my time
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
Thank you sir, it works fine you save my time
You are welcome.
none of the above solutions solved the issue for me. I'm on android studio 4 canary 15.
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
Thanks. This worked for me.
Same issue: Solved. My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.
Thanks. This worked for me.
You are welcome.
typedArray.recycle()//must be last line in init function