Android MaterialSpinner (Github) causes Inflate Exception - android

I am using a MaterialSpinner library from github(https://github.com/ganfra/MaterialSpinner) in my application.When I try to run in genymotion emulator, it works ok.But when I try to run it on my smartphone it shoes InflateException for the MaterialSpinner.
Error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jobinsabu.destination/com.example.jobinsabu.destination.MainActivity}: android.view.InflateException: Binary XML file line #100: Error inflating class fr.ganfra.materialspinner.MaterialSpinner
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2252)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2306)
at android.app.ActivityThread.access$700(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5302)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #100: Error inflating class fr.ganfra.materialspinner.MaterialSpinner
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
at com.example.jobinsabu.destination.MainActivity.onCreate(MainActivity.java:102)
at android.app.Activity.performCreate(Activity.java:5326)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2306) 
at android.app.ActivityThread.access$700(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:176) 
at android.app.ActivityThread.main(ActivityThread.java:5302) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
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:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:593)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
at com.example.jobinsabu.destination.MainActivity.onCreate(MainActivity.java:102) 
at android.app.Activity.performCreate(Activity.java:5326) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2306) 
at android.app.ActivityThread.access$700(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:176) 
at android.app.ActivityThread.main(ActivityThread.java:5302) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NoClassDefFoundError: fr.ganfra.materialspinner.R$attr
at fr.ganfra.materialspinner.MaterialSpinner.initAttributes(MaterialSpinner.java:149)
at fr.ganfra.materialspinner.MaterialSpinner.init(MaterialSpinner.java:135)
at fr.ganfra.materialspinner.MaterialSpinner.<init>(MaterialSpinner.java:117)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:593) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
at com.example.jobinsabu.destination.MainActivity.onCreate(MainActivity.java:102) 
at android.app.Activity.performCreate(Activity.java:5326) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2306) 
at android.app.ActivityThread.access$700(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:176) 
at android.app.ActivityThread.main(ActivityThread.java:5302) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
at dalvik.system.NativeStart.main(Native Method) 
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/relative"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#drawable/bg7"
>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#android:color/transparent"
android:theme="#style/AppTheme"
android:titleTextColor="#ffffff"
app:titleTextColor="#ffffff" />
<com.miguelcatalan.materialsearchview.MaterialSearchView
android:id="#+id/search_view"
style="#style/MaterialSearchView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="#+id/rehold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/search_view"
android:layout_centerHorizontal="true"
android:visibility="invisible"
>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
>
</android.support.v7.widget.RecyclerView>
<Button
android:id="#+id/done"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text="Done"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Destination"
android:textColor="#fff"
android:textSize="25sp"
android:textStyle="italic"
android:layout_marginTop="135dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:background="#drawable/touricon"
android:layout_alignBottom="#+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp" />
<RelativeLayout
android:id="#+id/relative2"
android:layout_width="match_parent"
android:layout_height="140dp"
android:gravity="center"
android:layout_alignTop="#+id/rehold"
android:layout_below="#+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="120dp">
<ImageView
android:id="#+id/image1"
android:layout_width="30dp"
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="34dp"
android:layout_marginStart="34dp"
android:background="#drawable/marker"></ImageView>
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/spinner1"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:gravity="center"
app:ms_alignLabels="false"
app:ms_arrowColor="#color/arrow"
app:ms_arrowSize="23dp"
app:ms_hintColor="#color/hint"
app:ms_multiline="true"
app:ms_thickness="0.0dp"
app:popupTheme="#android:color/transparent"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/image1"
android:layout_toEndOf="#+id/image1" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
spinner_item.xml(layout of spinner items):
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="154dp"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:background="#drawable/spinner_style"
>
<TextView
android:id="#+id/item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="Aizwal"
android:textColor="#212121"
android:textSize="25sp"
android:layout_gravity="left|center_vertical" />
</FrameLayout>
MainActivity.java:
public class MainActivity extends AppCompatActivity{
public MaterialSpinner spinner;ArrayList l;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinner=(MaterialSpinner) findViewById(R.id.spinner1);
l = new ArrayList();
l.add("NewDelhi");
l.add("Mumbai");
l.add("Chennai");
l.add("Bangalore");
arrayAdapter=new ArrayAdapter<String>(this,R.layout.spinner_item,R.id.item1,l);
spinner.setAdapter(arrayAdapter);}}

Replace this
arrayAdapter=new ArrayAdapter<String>(this,R.layout.spinner_item,R.id.item1,l);
With
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, l);

Related

Not able to set another image below first image in linear layout

I'm working on some project and i use linear layout and set image and text in it. after ending first linear layout i want another linear layout and set image. But i'm setting image my app keep on crashing.
This is Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".guidance_new"
android:id="#+id/layout"
android:background="#drawable/bg_animation"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/hanging_lamp"
android:src="#drawable/bulb1"/>
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical"
>
<TextView
android:layout_width="150dp"
android:layout_height="70dp"
android:text="100W Bulb"
android:textColor="#000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="180dp"
android:id="#+id/textView1"/>
<TextView
android:layout_width="150dp"
android:layout_height="80dp"
android:text="Price:100/. Voltage:220V-240V ."
android:textColor="#a9a9a9"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="180dp"
android:id="#+id/textView2"/>
/////// layout is set here
</LinearLayout>
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/chandlier"
android:src="#drawable/chandelier"
android:layout_below="#id/linear1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_below="#id/linear1">
<TextView
android:layout_width="150dp"
android:layout_height="70dp"
android:text="Chandlier"
android:textColor="#000"
android:textStyle="bold"
android:layout_marginLeft="180dp"
android:textSize="20sp"/>
</LinearLayout>
</RelativeLayout>
And this is mainlog:
06-09 18:26:34.348 23904-23904/com.example.animation E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.animation, PID: 23904
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.animation/com.example.animation.guidance_new}: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class ImageView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.animation.guidance_new.onCreate(guidance_new.java:20)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.animation.guidance_new.onCreate(guidance_new.java:20) 
at android.app.Activity.performCreate(Activity.java:6248) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.animation:drawable/chandelier" (7f060064) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060064 a=-1 r=0x7f060064}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2617)
at android.content.res.Resources.loadDrawable(Resources.java:2555)
at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
at android.widget.ImageView.<init>(ImageView.java:152)
at android.widget.ImageView.<init>(ImageView.java:140)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.animation.guidance_new.onCreate(guidance_new.java:20) 
at android.app.Activity.performCreate(Activity.java:6248) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
06-09 18:26:34.357 23904-23927/com.example.animation V/FA: Connection attempt already in progress
Resource that you are trying to display in ImageView (chandelier) is invalid.
You can read in your log that: Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.animation:drawable/chandelier" (7f060064) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060064 a=-1 r=0x7f060064} Check if path to the file is correct and try to display other image.
Try this xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".guidance_new"
android:id="#+id/layout"
android:background="#drawable/bg_animation"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/hanging_lamp"
android:src="#drawable/bulb1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="70dp"
android:text="100W Bulb"
android:textColor="#000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="30dp"
android:id="#+id/textView1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="80dp"
android:text="Price:100/. Voltage:220V-240V ."
android:textColor="#a9a9a9"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="30dp"
android:id="#+id/textView2"/>
</LinearLayout>
/////// layout is set here
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/chandelier"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/chandlier"
android:src="#drawable/bulb1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="70dp"
android:textColor="#000"
android:textStyle="bold"
android:text="Chandlier"
android:textSize="20sp"
android:layout_marginLeft="30dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

Activity is crashing in api 19 and in api 25 it is showing abrupt behaviour

This is debug report inn api 19 emulator..
Caused by: android.view.InflateException: Binary XML file line #47: Error inflating class <unknown>
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.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.admin.clicknorder.FoodDetail.onCreate(FoodDetail.java:42)
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:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
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.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.admin.clicknorder.FoodDetail.onCreate(FoodDetail.java:42) 
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:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_shopping_cart_black_24dp.xml from drawable resource ID #0x7f020068
at android.content.res.Resources.loadDrawable(Resources.java:2096)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.widget.ImageView.<init>(ImageView.java:129)
at android.widget.ImageButton.<init>(ImageButton.java:87)
at android.support.design.widget.VisibilityAwareImageButton.<init>(VisibilityAwareImageButton.java:36)
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:157)
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:153)
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.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.admin.clicknorder.FoodDetail.onCreate(FoodDetail.java:42) 
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:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2092)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
at android.widget.ImageView.<init>(ImageView.java:129) 
at android.widget.ImageButton.<init>(ImageButton.java:87) 
at android.support.design.widget.VisibilityAwareImageButton.<init>(VisibilityAwareImageButton.java:36) 
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:157) 
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:153) 
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.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.admin.clicknorder.FoodDetail.onCreate(FoodDetail.java:42) 
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:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 
05-06 15:36:10.141 468-503/system_process E/InputDispatcher: channel '52947f70 com.example.admin.clicknorder/com.example.admin.clicknorder.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-06 15:36:10.141 468-503/system_process E/InputDispatcher: channel '52a636f8 com.example.admin.clicknorder/com.example.admin.clicknorder.Home (server)' ~ Channel is unrecoverably broken and will be disposed!
05-06 15:36:10.141 468-503/system_process E/InputDispatcher: channel '52a783c8 com.example.admin.clicknorder/com.example.admin.clicknorder.FoodList (server)' ~ Channel is unrecoverably broken and will be disposed!
05-06 15:36:10.285 5612-5612/com.example.admin.clicknorder E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
05-06 15:36:10.345 5612-5612/com.example.admin.clicknorder E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.admin.clicknorder, PID: 5612
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.admin.clicknorder/com.example.admin.clicknorder.Home}: java.lang.NullPointerException
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.admin.clicknorder.Home.onCreate(Home.java:78)
at android.app.Activity.performCreate(Activity.java:5231)
This is where error coming in fooddetails.java
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food_detail);
database=FirebaseDatabase.getInstance();
foods=database.getReference("Food");
This foodetail.xml activity file
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.admin.clicknorder.FoodDetail"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing"
android:layout_width="match_parent"
android:layout_height="350dp"
app:layout_scrollFlags="exitUntilCollapsed"
app:contentScrim="#0d0e0d"
app:expandedTitleTextAppearance="#android:color/transparent"
>
</android.support.design.widget.CollapsingToolbarLayout>
<ImageView
android:id="#+id/image_food"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="#null"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:title="Food Name"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="parallax"
/>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/btnCart"
app:srcCompact="#drawable/ic_shopping_cart_black_24dp"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:layout_anchor="#id/app_bar_layout"
app:layout_anchorGravity="bottom|right|end"
app:useCompatPadding="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nesterScrollView"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/food_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:padding="12dp"
android:text="Food Name"
android:textColor="#color/colorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:orientation="horizontal"
android:id="#+id/layout_price"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
app:srcCompat="#drawable/ic_attach_money_black_24dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/food_price"
android:layout_weight="9"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="1,000"
android:textColor="#color/colorPrimary"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
android:layout_width="100dp"
android:layout_height="30dp"
android:id="#+id/number_button"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginBottom="18dp"
app:textSize="8sp"
app:backGroundColor="#color/colorAccent"
app:initialNumber="1"
app:finalNumber="20"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
app:cardElevation="5dp"
app:cardUseCompatPadding="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/food_description"
android:layout_marginTop="12dp"
android:lineSpacingMultiplier="1.5"
android:padding="12dp"
android:text="description"
android:textColor="#android:color/black"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
If any more details will be required I'll edit my question.Thank you
As I see from log, you have troubles with drawable on FloatingActionButton with id R.id.btnCart
android.content.res.Resources$NotFoundException: File res/drawable/ic_shopping_cart_black_24dp.xml from drawable resource ID #0x7f020068 at
...
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector at
...
Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method
Probably you made a misprint, and changing app:srcCompact to app:srcCompat will fix it

android.view.InflateException: Binary XML file line #89: Error inflating class <unknown>

I am getting the error as android.view.InflateException: Binary XML file line #89: Error inflating class . Earlier this activity was running fine. But suddenly getting this error. Cleaned the project so many times. But didn't work.
My XML File is :
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#dddddd">
<include
layout="#layout/top_menu_layout"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_alignParentTop="true" />
<include layout="#layout/inc_fund_transfer_btn_group" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/sectionPaymentInput"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ftBtnGroup"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="3dp">
<include layout="#layout/inc_ft_fav_transaction" />
<include layout="#layout/inc_ft_from_acc_info" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#drawable/login_btn_bg"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
style="#style/FTTextViewStyleTitle"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:background="#ffffff"
android:gravity="left|center"
android:paddingLeft="10dp"
android:text="To Account"
android:textColor="#color/loginBtnBG"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:layout_marginLeft="4dp"
android:background="#color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:background="#ffffff"
android:orientation="vertical"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingRight="4dp">
<com.weiwangcn.betterspinner.library.BetterSpinner
android:id="#+id/ownAccFToAccountSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Select To Account"
android:paddingLeft="10dp"
android:textSize="14sp" />
<include layout="#layout/inc_ft_to_acc_info" />
</LinearLayout>
</LinearLayout>
<include layout="#layout/inc_ft_input_info" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<ScrollView
android:id="#+id/sectionConfirmationDetails"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ftBtnGroup"
android:visibility="gone">
<include layout="#layout/inc_ft_confirmation_details" />
</ScrollView>
<include
layout="#layout/inc_otp_input_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="#+id/ftBtnGroup" />
<include
layout="#layout/inc_ft_success"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ftBtnGroup" />
<ScrollView
android:id="#+id/sectionAddFavorite"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ftBtnGroup"
android:visibility="gone">
<include
layout="#layout/dialog_add_within_ft_favorite"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Exceptions are
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brainstation.ib.abbl/com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity}: android.view.InflateException: Binary XML file line #89: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #89: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NumberFormatException: Invalid long: "red"
at java.lang.Long.invalidLong(Long.java:125)
at java.lang.Long.parse(Long.java:362)
at java.lang.Long.parseLong(Long.java:353)
at com.android.internal.util.XmlUtils.parseUnsignedIntAttribute(XmlUtils.java:164)
at com.android.internal.util.XmlUtils.convertValueToUnsignedInt(XmlUtils.java:132)
at android.content.res.StringBlock.applyStyles(StringBlock.java:239)
at android.content.res.StringBlock.get(StringBlock.java:133)
at android.content.res.AssetManager.getPooledString(AssetManager.java:274)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:726)
at android.content.res.TypedArray.getText(TypedArray.java:96)
at android.widget.TextView.<init>(TextView.java:698)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:59)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:55)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
The code is successfully in running > API 20.
When I am going to run in kitkat then app is crashed.
Is there any problem in my XML file ?
You need to provide Color Code or Color Tag Instead of Color Name, Your Logs Says so.
Caused by: java.lang.NumberFormatException: Invalid long: "red"
Looking at your XML, you have forgot to declare your namespace in the beginning of your layout (RelativeLayout)
xmlns:android="http://schemas.android.com/apk/res/android"
here
<?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"
android:background="#dddddd">
Hope it helps, Cheers!

App works when I install an apk but not when running on emulator or device

I have a problem in Android Studio. If I generate an apk for my app and install the apk the app works but when I run my app with an emulator or a device, I get the following error:
11-21 13:20:10.248 1191-1191/com.foca.deboInventario E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foca.deboInventario/com.foca.deboInventario.DeboInventario}: android.view.InflateException: Binary XML file line #191: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #191: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
at android.app.Activity.setContentView(Activity.java:1867)
at com.foca.deboInventario.DeboInventario.onCreate(DeboInventario.java:162)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 
at android.app.Activity.setContentView(Activity.java:1867) 
at com.foca.deboInventario.DeboInventario.onCreate(DeboInventario.java:162) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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=0x7f02000e a=-1 r=0x7f02000e}
at android.content.res.Resources.loadDrawable(Resources.java:1897)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:120)
at android.widget.ImageView.<init>(ImageView.java:110)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 
at android.app.Activity.setContentView(Activity.java:1867) 
at com.foca.deboInventario.DeboInventario.onCreate(DeboInventario.java:162) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at
dalvik.system.NativeStart.main(Native Method) 
11-21 13:20:10.298 152-152/system_process W/ActivityManager: Force finishing activity com.foca.deboInventario/.DeboInventario
11-21 13:20:10.408 1191-1194/com.foca.deboInventario D/dalvikvm: GC_CONCURRENT freed 340K, 4% free 10837K/11271K, paused 20ms+15ms, total 140ms
11-21 13:20:10.738 152-155/system_process D/dalvikvm: GC_CONCURRENT freed 841K, 15% free 17081K/19911K, paused 23ms+24ms, total 296ms
11-21 13:20:10.919 152-166/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{416ab440 com.foca.deboInventario/.DeboInventario}
11-21 13:20:11.008 262-262/com.android.launcher W/EGL_emulation: eglSurfaceAttrib not implemented
11-21 13:20:12.858 1191-1191/? I/Process: Sending signal. PID: 1191 SIG: 9
11-21 13:20:12.868 152-307/system_process I/ActivityManager: Process com.foca.deboInventario (pid 1191) has died.
11-21 13:20:12.928 152-517/system_process W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#415a1258 attribute=null
11-21 13:20:21.248 152-166/system_process W/ActivityManager: Activity destroy timeout for ActivityRecord{416ab440 com.foca.deboInventario/.DeboInventario}
In the Activity, the first print statement appears however the second does not. The Activity crashes on setContentView:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println("Here1");
setContentView(R.layout.xml_deboinventario);
System.out.println("Here2");
Here is the 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/fondo_recepcion_inventario" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:text="#string/titulo_debo_inventario"
android:textColor="#color/black"
tools:ignore="SpUsage"
android:textSize="25dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_gravity="center_horizontal">
<!-- PRIMER BOTON - izquierda -->
<LinearLayout
android:layout_width="200px"
android:layout_height="200px"
android:layout_margin="40px"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="#+id/DI_boton_izq"
android:layout_width="#dimen/dim_boton_masgrande"
android:layout_height="#dimen/dim_boton_grande"
android:layout_margin="10px"
android:text="#string/palabra_inventarios"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/continuar_inventarios_en_curso"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
</LinearLayout>
<!-- SEGUNDO BOTON - centro -->
<LinearLayout
android:layout_width="200px"
android:layout_height="200px"
android:layout_margin="40px"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone" >
<Button
android:id="#+id/DI_boton_cen"
android:layout_width="#dimen/dim_boton_grande"
android:layout_height="#dimen/dim_boton_grande"
android:layout_margin="10px"
android:text="#string/empezar"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Comenzar Nuevo Inventario"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_gravity="center_horizontal">
<LinearLayout
android:layout_width="200px"
android:layout_height="200px"
android:layout_margin="40px"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="#+id/boton_compras"
android:layout_width="#dimen/dim_boton_masgrande"
android:layout_height="#dimen/dim_boton_grande"
android:layout_margin="10px"
android:text="#string/mensaje_boton_acceso_compras"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/acceder_para_cargar_las_compras"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
</LinearLayout>
<LinearLayout
android:layout_width="200px"
android:layout_height="200px"
android:layout_margin="40px"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone" >
<Button
android:id="#+id/button2"
android:layout_width="#dimen/dim_boton_grande"
android:layout_height="#dimen/dim_boton_grande"
android:layout_margin="10px"
android:text="#string/empezar"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/comenzar_nuevo_inventario"
android:textColor="#color/black"
android:textSize="#dimen/boton_grande" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/DI_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="#string/palabra_version"
android:textColor="#color/black"
android:textSize="12px"
tools:ignore="RelativeOverlap" />
<TextView
android:id="#+id/DI_idtablet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="#string/palabra_id_terminal"
android:textColor="#color/black"
android:textSize="12px" />
<ImageView
android:id="#+id/DI_imagen_debo"
android:layout_width="100px"
android:layout_height="100px"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20px"
android:layout_marginTop="20px"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="visible"
android:contentDescription=""
tools:ignore="ContentDescription">
</ImageView>
<ImageView
android:id="#+id/DI_imagen_salir"
android:layout_width="40px"
android:layout_height="40px"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="10px"
android:scaleType="fitXY"
android:src="#drawable/boton_salir"
android:visibility="visible"
tools:ignore="ContentDescription">
</ImageView>
<ImageView
android:id="#+id/DI_imagen_config"
android:layout_width="40px"
android:layout_height="40px"
android:layout_alignParentTop="true"
android:layout_margin="10px"
android:layout_toLeftOf="#+id/DI_imagen_salir"
android:src="#drawable/boton_config"
tools:ignore="ContentDescription">
</ImageView>
<ImageView
android:id="#+id/DI_imagen_update"
android:layout_width="50px"
android:layout_height="50px"
android:layout_alignParentTop="true"
android:layout_margin="6px"
android:layout_toLeftOf="#+id/DI_imagen_config"
android:src="#drawable/boton_update"
tools:ignore="ContentDescription">
</ImageView>
</RelativeLayout>
I gave android:background a color but still get the same issue.
I have also tried cleaning and rebuilding the project.
Can someone tell me what is the problem and how to solve this issue?
Could this be due to an update in Android Studio?
Thanks!
I fix the problem. Change the version grandle.
Android studio ide update some changes and edit Grandle Scripts/build.grandle in my project.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:2.2.2' Version IDE update
classpath 'com.android.tools.build:gradle:1.5.0' // Version before update
}
}
Now i can run and debug the project again. Thanks a lot all.

android.view.InflateException: Binary XML file line #31: Error inflating class ImageView

I am trying to add an ImageView into a CardView widget but when i go to open the activity that contains my cardview the app crashes and I get this error message in my logcat
android.view.InflateException: Binary XML file line #31: Error inflating class ImageView
I've seen other people have had this problem and the solution was to reduce the size of the image itself contained in the drawable folder I am now using an image with a size of 295x197px is this still too big?
Here is my cardview xml file the cardview i am working on is the first one in the file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="2dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.brian.barter2.furniture"
tools:showIn="#layout/app_bar_furniture"
android:background="#efefef">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view1"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/furniture_img1"/>
<TextView
android:text="Product"
android:gravity="bottom"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view2"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="300dp"
card_view:cardCornerRadius="4dp">
<TextView
android:id="#+id/info_text2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/ic_menu_gallery"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="300dp"
card_view:cardCornerRadius="4dp">
<TextView
android:id="#+id/info_text3"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_menu_gallery"/>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
Here is the stacktrace:
04-13 20:25:23.930 32498-32498/com.example.brian.barter2 E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.brian.barter2/com.example.brian.barter2.furniture}: android.view.InflateException: Binary XML file line #31: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.brian.barter2.furniture.onCreate(furniture.java:25)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
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=0x7f02004d a=-1 r=0x7f02004d}
at android.content.res.Resources.loadDrawable(Resources.java:1892)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:120)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:972)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1031)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.example.brian.barter2.furniture.onCreate(furniture.java:25) 
at android.app.Activity.performCreate(Activity.java:5008) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
at android.app.ActivityThread.access$600(ActivityThread.java:130) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4745) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 
04-13 20:25:25.234 32498-32498/? I/Process: Sending signal. PID: 32498 SIG: 9
Any input would be greatly appreciate thanks.

Categories

Resources