Issue
Why when I run my project I get this error? I've been searching for this issue but I didn't find any solution for it
Unable to start activity ComponentInfo: android.view.InflateException:
Binary XML file line #0: Error inflating class <unknown>
It´s a simple sign up activity.
Here is the code:
XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/layout_topbar_toolbar"
android:id="@+id/signup_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="25dp"
android:layout_marginTop="25dp"
android:layout_below="@id/signup_toolbar">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:maxLines="1"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:hint="@string/form_email_short"
android:id="@+id/input_email"
android:background="@drawable/edittext_white_square"
android:textCursorDrawable="@null"
android:textSize="@dimen/text_edit_text"/>
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="15dp"
android:maxLines="1"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:hint="@string/form_password_short"
android:id="@+id/input_password"
android:background="@drawable/edittext_white_square"
android:textCursorDrawable="@null"
android:textSize="@dimen/text_edit_text"/>
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Sign Up!"
android:id="@+id/btn_create"
android:padding="12dp"
android:textSize="@dimen/text_button"
android:textColor="@color/white"
android:background="@drawable/button_accent_square"/>
</LinearLayout>
</RelativeLayout>
The toolbar XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:theme="@style/Base.ThemeOverlay.AppCompat.Dark.ActionBar">
</android.support.v7.widget.Toolbar>
The edittext drawable:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid
android:color="@color/white"/>
<stroke android:width="1dp"
android:color="@color/greyXLight"/>
<corners
android:radius="3dp"/>
</shape>
</item>
I'm testing it in an emulator with API 22 and min API 16
Please let me know if you need more info. Thanks.
Solution
Your drawable isn't too complicated that it needs to be in a specific API level.
Move it to res/drawable (create this if it doesn't exist).
Or at least make a v16 drawable folder so it corresponds to the minimum API level you've set
Answered By - OneCricketeer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.