Android应用程序错误无法启动活动ComponentInfo

时间:2017-08-20 19:24:17

标签: java android android-intent

嗨我做了一个应用程序,它在许多设备上运行完美,但在某些设备中主屏幕不起作用,并且在选择注册活动时,应用程序出错,不幸停止。

我正在使用 15minSDK 26TargetedSdk 和26Use Compile SDK

下面是我的logcat错误。 请帮助谢谢:)

08-20 11:16:57.007 21625-21625/com.jeffysmak.blooddonationpk
 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: com.jeffysmak.blooddonationpk, PID: 21625
                                                                                java.lang.RuntimeException: Unable to start activity
 ComponentInfo{com.jeffysmak.blooddonationpk/com.jeffysmak.blooddonationpk.UserRegister}:
 android.view.InflateException: Binary XML file line #9: Error
 inflating class ImageView
                                                                                    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
                                                                                    at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
                                                                                    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:5045)
                                                                                    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:779)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                                                    at dalvik.system.NativeStart.main(Native Method)
                                                                                 Caused by: android.view.InflateException: Binary XML file line #9:
 Error inflating class ImageView
                                                                                    at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
                                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                                                                    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.jeffysmak.blooddonationpk.UserRegister.onCreate(UserRegister.java:95)
                                                                                    at android.app.Activity.performCreate(Activity.java:5231)
                                                                                    at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
                                                                                    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2163)
                                                                                    at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 
                                                                                    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:5045) 
                                                                                    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:779) 
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                                                    at dalvik.system.NativeStart.main(Native Method) 
                                                                                 Caused by: android.content.res.Resources$NotFoundException: Resource
 is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f02008a a=-1
 r=0x7f02008a}
                                                                                    at android.content.res.Resources.loadDrawable(Resources.java:2068)
                                                                                    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                                                                                    at android.widget.ImageView.<init>(ImageView.java:129)
                                                                                    at
 android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:60)
                                                                                    at
 android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
                                                                                    at
 android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                                                                                    at
 android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1026)
                                                                                    at
 android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1083)
                                                                                    at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
                                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
                                                                                    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.jeffysmak.blooddonationpk.UserRegister.onCreate(UserRegister.java:95) 
                                                                                    at android.app.Activity.performCreate(Activity.java:5231) 
                                                                                    at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) 
                                                                                    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2163) 
                                                                                    at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 
                                                                                    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:5045) 
                                                                                    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:779) 
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                                                    at dalvik.system.NativeStart.main(Native Method)  08-20 11:17:01.003
 21625-21653/com.jeffysmak.blooddonationpk W/DynamiteModule: Local
 module descriptor class for com.google.firebase.auth not found.

我的活动xml。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash"
    tools:context="com.jeffysmak.blooddonationpk.UserRegister">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:padding="16dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:focusableInTouchMode="true"
            android:orientation="vertical">


            <TextView
                android:id="@+id/a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="10dp"
                android:text="REGISTRATION"
                android:textColor="@color/colorPrimaryOrange"
                android:textSize="18sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/a"
                android:layout_gravity="center"
                android:text="All Feilds are required *"
                android:textAllCaps="true"
                android:textColor="#fff" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@+id/b"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="30dp"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/thumba"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:src="@drawable/user"
                        android:tint="#fff" />

                    <EditText
                        android:id="@+id/user_Name"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:layout_marginBottom="20dp"
                        android:layout_toRightOf="@id/thumba"
                        android:backgroundTint="#fff"
                        android:cursorVisible="true"
                        android:hint="Name"
                        android:textColor="@color/colorPrimaryOrange"
                        android:textColorHint="#fff" />
                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/thumbaq"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:src="@drawable/new_email_outline"
                        android:tint="#fff" />

                    <EditText
                        android:id="@+id/user_email"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:layout_marginBottom="20dp"
                        android:layout_toRightOf="@id/thumbaq"
                        android:backgroundTint="#fff"
                        android:cursorVisible="true"
                        android:hint="Email"
                        android:inputType="textEmailAddress"
                        android:textColor="@color/colorPrimaryOrange"
                        android:textColorHint="#fff" />
                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/thumbb"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:src="@drawable/password"
                        android:tint="#fff" />

                    <EditText
                        android:id="@+id/user_Password"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:layout_marginBottom="20dp"
                        android:layout_toRightOf="@id/thumbb"
                        android:backgroundTint="#fff"
                        android:hint="Password"
                        android:inputType="textPassword"
                        android:textColor="@color/colorPrimaryOrange"
                        android:textColorHint="#fff" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/thumbc"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:src="@drawable/contactus" />

                    <EditText
                        android:id="@+id/user_Contact"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:layout_marginBottom="20dp"
                        android:layout_toRightOf="@id/thumbc"
                        android:backgroundTint="#fff"
                        android:hint="Phone Number"
                        android:inputType="number"
                        android:textColor="@color/colorPrimaryOrange"
                        android:textColorHint="#fff" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/thumbd"
                        android:layout_width="35dp"
                        android:layout_height="35dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:src="@drawable/facebook_placeholder_for_locate_places_on_maps"
                        android:tint="#fff" />


                    <Spinner
                        android:id="@+id/Reg_City"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:layout_centerVertical="true"
                        android:layout_margin="10dp"
                        android:layout_toRightOf="@id/thumbd"
                        android:backgroundTint="#fff"
                        android:textColor="@color/colorPrimaryOrange">

                    </Spinner>

                </RelativeLayout>

                <Button
                    android:id="@+id/RegisterBTN"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="15dp"
                    android:layout_marginBottom="20dp"
                    android:background="@drawable/btn"
                    android:text="REGISTER"
                    android:textColor="#fff" />


            </LinearLayout>
        </LinearLayout>


    </ScrollView>

</RelativeLayout>

1 个答案:

答案 0 :(得分:-1)

在您的Relative Layout中,您的绘图尺寸或绘图的分辨率太大而无法处理。

尝试使用android:background="@drawable/splash"

中较小版本的图片替换您的drawable