Please follow these Steps:
For Eclipse:
Properties
Java Build Path
Libraries
tab. There click the Add External JARs
Button on the Right pane.android-support-v4.jar
file, usually the path for the Jar file is :android-support-v4.jar
Library, navigate to the Order and Export
tab and put check mark on the android-support-v4
Library file.For Android Studio:
Short Version:
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:
I hope this helps.