Android - 二进制XML文件行#0:错误膨胀类android.support.design.widget.TextInputEditText

时间:2018-01-27 18:19:04

标签: java android xml

伙计们,我似乎正在为我正在处理的应用程序的已签名apk做出奇怪的错误。起初我以为是因为我添加了对java 1.8的支持,但随后它从4.1到7.1完美地运行在调试版本上。

  • minSdkVersion 16
  • targetSdkVersion 27
  • compileSdkVersion 27
  • buildToolsVersion' 26.0.2'

我在xml布局中没有使用任何背景属性,因此我不确定问题是什么。

我正在运行Android Studio 3.0.1

java.lang.RuntimeException: Unable to start activity ComponentInfo{dita.dev.myportal/dita.dev.myportal.ui.login.LoginActivity}: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.TextInputEditText
 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: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.TextInputEditText
 at android.view.LayoutInflater.createView(LayoutInflater.java:620)
 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 abp.b(AppCompatDelegateImplV9.java:287)
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
 at dita.dev.myportal.ui.login.LoginActivity.onCreate(LoginActivity.java:38)
 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) 
Caused by: java.lang.reflect.InvocationTargetException
 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 abp.b(AppCompatDelegateImplV9.java:287) 
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
 at dita.dev.myportal.ui.login.LoginActivity.onCreate(LoginActivity.java:38) 
 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) 
Caused by: java.lang.NullPointerException
 at android.support.v7.widget.AppCompatEditText.setBackgroundDrawable(AppCompatEditText.java:86)
 at android.view.View.setBackground(View.java:15322)
 at android.view.View.<init>(View.java:3874)
 at android.widget.TextView.<init>(TextView.java:623)
 at android.widget.EditText.<init>(EditText.java:60)
 at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:64)
 at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:60)
 at android.support.design.widget.TextInputEditText.<init>(TextInputEditText.java:41)
 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 abp.b(AppCompatDelegateImplV9.java:287) 
 at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
 at dita.dev.myportal.ui.login.LoginActivity.onCreate(LoginActivity.java:38) 
 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)

这里是xml代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/swipeRefreshLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary"
    tools:context=".ui.login.LoginActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <LinearLayout
            android:id="@+id/layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"

            android:padding="24dp"
            android:weightSum="1">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="0.6"
                android:contentDescription="@string/my_portal_logo"
                android:padding="40dp"
                app:srcCompat="@drawable/logo" />

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                app:hintEnabled="false">

                <android.support.design.widget.TextInputEditText
                    android:id="@+id/username"
                    style="@style/LoginEditStyle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/username"
                    android:imeOptions="actionNext"
                    android:lines="1"
                    android:padding="8dp" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                app:hintEnabled="false"
                app:passwordToggleEnabled="true"
                app:passwordToggleTint="@android:color/white">

                <android.support.design.widget.TextInputEditText
                    android:id="@+id/password"
                    style="@style/LoginEditStyle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/password"
                    android:imeOptions="actionDone"
                    android:inputType="textPassword"
                    android:lines="1"
                    android:maxLength="30"
                    android:padding="8dp" />
            </android.support.design.widget.TextInputLayout>


            <Button
                android:id="@+id/login"
                style="@style/LoginButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/login" />

        </LinearLayout>
    </ScrollView>


</android.support.v4.widget.SwipeRefreshLayout>

以下是gradle依赖项:

dependencies {
    //compile fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-config:11.8.0'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true
    }
    //compile files('libs/poi-3.14.jar')
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:support-vector-drawable:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:gridlayout-v7:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.squareup.okhttp3:okhttp:3.7.0'
    implementation 'io.realm:android-adapters:2.1.0'
    implementation 'org.jsoup:jsoup:1.10.2'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    implementation 'com.github.PhilJay:MPAndroidChart-Realm:v2.0.2@aar'
    implementation 'com.github.ganfra:material-spinner:1.1.1'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.evernote:android-job:1.1.9'
    implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
    implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
    implementation 'com.andkulikov:transitionseverywhere:1.7.4'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.13.0'
    implementation 'com.rollbar:rollbar-android:0.2.1'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

0 个答案:

没有答案