Please follow these Steps:
For Eclipse:
- Go to your Project's
Properties
- Navigate to the
Java Build Path
- Then go to the
Libraries
tab. There click theAdd External JARs
Button on the Right pane. - Select the
android-support-v4.jar
file, usually the path for the Jar file is :
YOUR_DRIVE\android-sdks\extras\android\support\v4\android-support-v4.jar - After adding
android-support-v4.jar
Library, navigate to theOrder and Export
tab and put check mark on theandroid-support-v4
Library file. - After doing the above, Clean the Project and Build it.
- Problem Solved.
For Android Studio:
Short Version:
- Add the following line to your
build.gradle
file:
implementation 'com.android.support:support-v4:YOUR_TARGET_VERSION'
Long Version:
Go to File -> Project Structure
Go to "Dependencies" Tab -> Click on the Plus sign -> Go to "Library dependency"
Select the support library "support-v4 (com.android.support:support-v4:YOUR_TARGET_VERSION)"
Navigate to your "build.gradle" inside your App Directory and double check if your desired Android Support Library has been added to your dependencies.
Rebuild your project and now everything should work.
Further reading regarding this Question:
- Support Library - Android Dev
- Recent Support Library Revisions
- Support Library Packages
- What is an Android Support Library?
- How Android Support Library work?
I hope this helps.