Error inflating class android.support.design.widget.TextInputLayout

泪湿孤枕 提交于 2019-12-11 06:34:42

问题


when i change my library 23.0.1 to 23.3.0 then this error will occur and i have to change my library. so give me answer and solution.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.inn.microwave/com.inn.microwave.LoginActivity}: android.view.InflateException: Binary XML file line #37: Error inflating class android.support.design.widget.TextInputLayout
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
   at android.app.ActivityThread.access$800(ActivityThread.java:135)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5001)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
   at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
   at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:34)
   at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:134)
   at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:127)
   at java.lang.reflect.Constructor.constructNative(Native Method) 
   at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
   at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
   at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
   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.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) 
   at android.app.Activity.setContentView(Activity.java:1929) 
   at com.inn.microwave.LoginActivity.onCreate(LoginActivity.java:77) 
   at android.app.Activity.performCreate(Activity.java:5231) 
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
   at android.app.ActivityThread.access$800(ActivityThread.java:135) 
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
   at android.os.Handler.dispatchMessage(Handler.java:102) 
   at android.os.Looper.loop(Looper.java:136) 
   at android.app.ActivityThread.main(ActivityThread.java:5001) 
   at java.lang.reflect.Method.invokeNative(Native Method) 
   at java.lang.reflect.Method.invoke(Method.java:515) 
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
   at dalvik.system.NativeStart.main(Native Method)     

Build.gradle

    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
    applicationId "com.inn.microwave"
    minSdkVersion 16
    targetSdkVersion 23

Dependancy

compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'

回答1:


Finnaly i solved ERROR

i have been set correct themes in Manifest.xml <appliction> Tag but i was set manually wrong theme in my <activity> Tag.

So, i remove theme from <activity> TAG of manifest.xml




回答2:


add this dependency in build.gradle

implementation 'com.android.support:design:27.1.1'

will solve your issue




回答3:


just clean your project and rebuilt it before run that project. it will solve your problem.



来源:https://stackoverflow.com/questions/38569071/error-inflating-class-android-support-design-widget-textinputlayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!