Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android.view.InflateException: Binary XML file line #0: Error inflating class android.widget.EditText #417

Open
iad24 opened this issue Oct 12, 2017 · 56 comments

Comments

@iad24
Copy link

iad24 commented Oct 12, 2017

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

@cotfas
Copy link

cotfas commented Nov 1, 2017

I`m having the same issue..

@iad24
Copy link
Author

iad24 commented Nov 1, 2017

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.

@xPryds
Copy link

xPryds commented Nov 18, 2017

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.

@swat-cat
Copy link

Same issue with LG H810 Android 5.1

@enriqkeg
Copy link

enriqkeg commented Jan 8, 2018

Same problem with LG k240h 6.0

@CaviaTheGuineaPig
Copy link

I had the same bug, and cause by the attribute "BackgroundTint" in the Floating button view

@Tizhoodh82
Copy link

Tizhoodh82 commented Jan 12, 2018

I have same issue in SAMSUNG GLAXAY J5 .

@uliluck
Copy link

uliluck commented Jan 18, 2018

same issue in android studio 3.0
OS 4.4.2

@Sufi313
Copy link

Sufi313 commented Feb 1, 2018

/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

@Sufi313
Copy link

Sufi313 commented Feb 1, 2018

Hi! guys i have this error when i run application in kitkat i know multidex and i enabled but error show

@sshahidaslamm
Copy link

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

@techview51
Copy link

Same issue: Solved.
My image files were in the "drawable-v24" folder. I copied them to the "drawable" folder too. Problem solved.

@ariel179
Copy link

ariel179 commented Mar 7, 2018

@techview51 you saved my life thank you!!!!

@RofaeilAshaiaa
Copy link

@sshahidaslamm your solution solved my problem!

@techview51
Copy link

@ariel179 You are welcome.

@AdrianoJunior
Copy link

Same problem here but with Fragment.

@ghost
Copy link

ghost commented Mar 29, 2018

@techview51 Copied and fixed, thank you so much!

@samk17cmutpm
Copy link

@techview51 Thank you so much !

@ghost
Copy link

ghost commented Mar 29, 2018

@techview51 thanks a ton mate 🗡

@techview51
Copy link

techview51 commented Apr 11, 2018

@TBaulos , @samk17cmutpm , @UnselfconsciousLux : You are welcome.

@georgetsiga
Copy link

Also had the same ussue, I did what @techview51 said and it worked.

@allexiusw
Copy link

@techview51 thanks for solutions... very simple!

@CowardlyVillain
Copy link

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.(View.java:4001)
at android.widget.TextView.(TextView.java:700)
at android.widget.Button.(Button.java:109)
at android.widget.Button.(Button.java:105)
at android.support.v7.widget.AppCompatButton.(AppCompatButton.java:65)
at android.support.v7.widget.AppCompatButton.(AppCompatButton.java:61)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1023)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1080)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746)
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) 

@anshkumarsaha
Copy link

anshkumarsaha commented May 17, 2018

you need to change AppTheme @styles.xml like
its really work

<style name="AppTheme" parent="Theme.AppCompat.menuCompact"> to <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

@chrisjenx
Copy link
Owner

Interesting, appt2 shouldn't break this, we'll need to raise a bug report to see why it's doing it

@sdeff
Copy link

sdeff commented Jun 13, 2018

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".

@ghost
Copy link

ghost commented Jul 5, 2018

@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

@sanjayajena37
Copy link

sanjayajena37 commented Jul 14, 2018

@techview51 Thanks bro..I complete my app successfully.Just Because of you.Again thanks bro.

@auzanassdq
Copy link

@techview51 thanks dude..

@techview51
Copy link

@auzanassdq @sanjayajena37 @AllexSv @georgetsiga
You are welcome.

@soheltanvir0699
Copy link

@techview51 thanks bro.....my problemis solve

@techview51
Copy link

@soheltanvir0699 You are welcome.

@PrajeetShrestha
Copy link

@techview51 Wasted 4 hours trying to solve the problem. The simple copy of image to drawable folder solved. But why does this work?

@zhengwu119
Copy link

@techview51 Thanks.

@51600104
Copy link

@techview51 Are u a hero, sir ? , you just save my life !!!

@rpattabi
Copy link

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.

@AnangNawawi
Copy link

@sshahidaslamm Thank you, you solved my problem

@JayTailor45
Copy link

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 👍

@ruman86
Copy link

ruman86 commented May 13, 2019

@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.

@color/colorSpecial

<style name="mytheme" parent="xyz"> @color/title </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.

@Chandrakala14
Copy link

Chandrakala14 commented May 30, 2019

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'
        }

@Moonlighter
Copy link

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
Copy link

@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
Copy link

@techview51 Thanks.

You are welcome.

@techview51
Copy link

@techview51 Are u a hero, sir ? , you just save my life !!!

Glad to hear that. Good luck.

@techview51
Copy link

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.

@techview51
Copy link

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.

@JwalaApporio
Copy link

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.

@naveedahmad99
Copy link

copied

In my case, no drawable 24 folder exist, nor values and layout.

@Duna
Copy link

Duna commented Sep 2, 2020

in my case I do not have drawable-24 or 21 in the project

@AhmedMahmoudRizk
Copy link

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

@techview51
Copy link

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.

@aeonSolutions
Copy link

none of the above solutions solved the issue for me.
I'm on android studio 4 canary 15.

@sangeet-shikha
Copy link

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.

@techview51
Copy link

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.

@AbdullahAbuMadi
Copy link

typedArray.recycle()//must be last line in init function

@FarhanaAkterSuci
Copy link

FATAL EXCEPTION: main
Process: com.example.smartalarm, PID: 8423
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.smartalarm/com.example.smartalarm.Activity2}: android.view.InflateException: Binary XML file line #15 in com.example.smartalarm:layout/activity_2: Binary XML file line #15 in com.example.smartalarm:layout/activity_2: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3771)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3938)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2291)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8309)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)
Caused by: android.view.InflateException: Binary XML file line #15 in com.example.smartalarm:layout/activity_2: Binary XML file line #15 in com.example.smartalarm:layout/activity_2: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #15 in com.example.smartalarm:layout/activity_2: Error inflating class fragment
Caused by: java.lang.NullPointerException
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Fragment.instantiate(Fragment.java:536)
at android.app.FragmentContainer.instantiate(FragmentContainer.java:53)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3553)
at android.app.FragmentController.onCreateView(FragmentController.java:105)
at android.app.Activity.onCreateView(Activity.java:7264)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1096)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1024)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:988)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1150)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1111)
at android.view.LayoutInflater.inflate(LayoutInflater.java:709)
at android.view.LayoutInflater.inflate(LayoutInflater.java:547)
at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:775)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:197)
at com.example.smartalarm.Activity2.onCreate(Activity2.java:13)
at android.app.Activity.performCreate(Activity.java:8176)
at android.app.Activity.performCreate(Activity.java:8143)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1330)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3744)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3938)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2291)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
2023-11-10 12:57:19.672 8423-8423 AndroidRuntime com.example.smartalarm E at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8309)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests