java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat

You are getting NoClassDefFoundError & ClassNotFoundException

NoClassDefFoundError in Java comes when Java Virtual Machine is not
able to find a particular class at runtime which was available at
compile time.

FYI

You are using Eclipse. Android Studio is a far simpler way to develop for Android if you manage to get the hang of it. For developers who have been using Eclipse, migrating to Studio is a nightmare for them. Eclipse is dead (My personal opinion).

For your NoClassDefFoundError problem goto rebuild option under Project > Clean and then select the project you want to clean up .Then Restart your Eclipse and run again .

Solutions

Check your classpath contains that jar (AppCompat), if your classpath
doesn’t contain the jar then just add that class in your classpath.

You should Use Android Studio instead of Eclipse . Read

  1. Support Library Features

The Gradle build script dependency identifier for this library is as follows:

com.android.support:appcompat-v7:24.2.1

Then Clean-Rebuild-Restart IDE

Leave a Comment