1

I want to use the Switchcompat in my application. I added the appcompat v7 support library into my project but when i am trying to use the switchcompat in my xml it is giving me following error :

The following classes could not be found: - android.support.v7.widget.SwitchCompat (Fix Build Path, Edit XML, Create Class)

From the error I am guessing that my project is not able to refer the library project even though i have added the library project as shown :

enter image description here

My XML is as follows: <android.support.v7.widget.SwitchCompat android:layout_width="wrap_content" android:layout_height="wrap_content"/>

Kindly help what is the issue.Thanks in advance.

Preeti Wadhwani
  • 305
  • 1
  • 3
  • 15

1 Answers1

0

Try adding android-support-v7-appcompat.jar to build path in library. You should be getting similar view if you are doing all right!

Sreenshot

Harin
  • 2,413
  • 3
  • 15
  • 30
  • If you got SwitchCompat class listed than you are up! – Harin Mar 23 '15 at 13:24
  • I tried that still it is not showing ..In the project explorer for my project it is not showing the Android private libraries folder. – Preeti Wadhwani Mar 23 '15 at 13:43
  • When you create a new project(eclipse) Android private libraries by default appears man! and let me guess you are using Theme.AppCompat style in project right? – Harin Mar 23 '15 at 13:55
  • I am using Theme.AppCompat style in project , I created new project in which i am able to use the switch but the private libraries folder is not present in the old project while in the new project evrything is there as you mentioned. I am not able to understand what i have missed. – Preeti Wadhwani Mar 23 '15 at 14:20
  • I am using other library projects also in my application due to which i get build error as follows : Jar mismatch! Fix your dependencies. Is it because of this the private libraries are not getting generate? – Preeti Wadhwani Mar 23 '15 at 14:36
  • Jar mismatch mostly happens when u have different versions of appcomatV4 library included in library project and your project. Be aware of that. – Harin Mar 24 '15 at 05:32