user3278732
user3278732

Reputation: 1724

Binary XML file line : Error inflating class android.support.v7.widget.CardView

 <LinearLayout 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:orientation="vertical"
tools:context="com.netvariant.nissan_survey.MainActivity" >
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >
    <ImageView
        android:layout_width="244dp"
        android:layout_height="70dp"
        android:layout_alignParentLeft="true"
        android:contentDescription="@string/app_name"
        android:src="@drawable/header_feedback" >
    </ImageView>
    <ImageView
        android:layout_width="244dp"
        android:layout_height="70dp"
        android:layout_alignParentRight="true"
        android:contentDescription="@string/app_name"
        android:src="@drawable/logo" >
    </ImageView>
</RelativeLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray"
    android:orientation="vertical" >
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:src="@drawable/header_arrow" >
    </ImageView>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingBottom="40dp" >
        <TextView
            android:layout_width="230dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:singleLine="false"
            android:text="@string/choose"
            android:textSize="24sp" />
        <FrameLayout
            android:layout_width="250dp"
            android:layout_height="250dp"
            android:layout_gravity="center"
            android:background="@android:color/white"
            android:gravity="center"
            android:orientation="vertical" >
            <android.support.v7.widget.CardView
                android:id="@+id/cv"
                xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:paddingLeft="25dp"
                android:background="@android:color/black"
                android:paddingRight="25dp"
                android:paddingTop="25dp" >
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/arabic"
                    android:textColor="@android:color/white" >
                </TextView>
            </android.support.v7.widget.CardView>
              <android.support.v7.widget.CardView
                android:id="@+id/cv1"
                xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:layout_width="200dp"
                android:background="@android:color/black"
                android:layout_height="wrap_content"
                android:paddingLeft="25dp"
                android:paddingRight="25dp"
                android:paddingTop="25dp" >
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/english"
                    android:textColor="@android:color/white" >
                </TextView>
            </android.support.v7.widget.CardView>
        </FrameLayout>
    </LinearLayout>
</LinearLayout>

Whats wrong with my code? Why I get such error on card view, which is line 71. I still cannot find a solution, while i implement same as tutorials. Please help if possible. i added some properties, removed some.no influence and same error over and over again

Upvotes: 0

Views: 303

Answers (2)

user668994
user668994

Reputation:

In React-native you need to force the same version for appcompat in your gradle.build,

configurations.all {
    resolutionStrategy {
        force 'com.android.support:appcompat-v7:23.4.0'
    }
}

Upvotes: 1

jujyfruits
jujyfruits

Reputation: 86

Have you added the CardView dependency in your module's build.gradle file? Make sure you have it because it's the same exception you get when you forget including it.

compile 'com.android.support:cardview-v7:21.0.+'

Upvotes: 0

Related Questions