Home » Android » android – java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat

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

Posted by: admin April 23, 2020 Leave a comment


I have updated the AppCompat libraries to 24.2.1 and the SDK to Android 7 in my Eclipse install.
Since that, I’m not capable to run any of my apps.
I appreciate if you can help a bit with that…

E/AndroidRuntime(17555): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat;
E/AndroidRuntime(17555):    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:196)
E/AndroidRuntime(17555):    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181)
E/AndroidRuntime(17555):    at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521)
E/AndroidRuntime(17555):    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
E/AndroidRuntime(17555):    at com.ryosoftware.calendareventsnotifier.MainActivity.onCreate(MainActivity.java:844)
E/AndroidRuntime(17555):    at android.app.Activity.performCreate(Activity.java:5990)
E/AndroidRuntime(17555):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
E/AndroidRuntime(17555):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
E/AndroidRuntime(17555):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
E/AndroidRuntime(17555):    at android.app.ActivityThread.access$900(ActivityThread.java:154)
E/AndroidRuntime(17555):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
E/AndroidRuntime(17555):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(17555):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(17555):    at android.app.ActivityThread.main(ActivityThread.java:5294)
E/AndroidRuntime(17555):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17555):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(17555):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime(17555):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
E/AndroidRuntime(17555): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.os.BuildCompat" on path: DexPathList[[zip file "/data/app/com.ryosoftware.calendareventsnotifier-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime(17555):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(17555):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(17555):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime(17555):    ... 18 more
E/AndroidRuntime(17555):    Suppressed: java.lang.ClassNotFoundException: android.support.v4.os.BuildCompat
E/AndroidRuntime(17555):        at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(17555):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime(17555):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime(17555):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime(17555):        ... 19 more
E/AndroidRuntime(17555):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
How to&Answers:

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.


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 .


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:


Then Clean-Rebuild-Restart IDE


In my case

  1. clean project
  2. invalidate and restart

it’s work


I added two classes in my java package and its working fine, keep both class as showing in below image:

enter image description here


public class AsyncTaskCompat {

 * Executes the task with the specified parameters, allowing multiple tasks to run in parallel
 * on a pool of threads managed by {@link android.os.AsyncTask}.
 * @param task The {@link android.os.AsyncTask} to execute.
 * @param params The parameters of the task.
 * @return the instance of AsyncTask.
public static <Params, Progress, Result> AsyncTask<Params, Progress, Result> executeParallel(
        AsyncTask<Params, Progress, Result> task, Params... params) {
    if (task == null) {
        throw new IllegalArgumentException("task can not be null");

    if (Build.VERSION.SDK_INT >= 11) {
        // From API 11 onwards, we need to manually select the THREAD_POOL_EXECUTOR
        AsyncTaskCompatHoneycomb.executeParallel(task, params);
    } else {
        // Before API 11, all tasks were run in parallel

    return task;


class AsyncTaskCompatHoneycomb {

static <Params, Progress, Result> void executeParallel(
        AsyncTask<Params, Progress, Result> task, Params... params) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);


Another ugly reason for this to be caused is if you’re trying to attach a debugger with breakpoint on something that happens during Activity creation.


In my case the error was caused due to the use of the entire gms:play-services library. Some components of gms:play-services refer to versions other than explicitly specified by you.

Use only the required play-services which are required e.g: ‘com.google.android.gms:play-services-analytics:10.2.0’ instead of ‘com.google.android.gms:play-services:10.2.0’.

Also see: All com.android.support libraries must use the exact same version specification

Good read: https://blog.mindorks.com/avoiding-conflicts-in-android-gradle-dependencies-28e4200ca235


public class MApplication extends Application {

    protected void attachBaseContext(Context paramContext) {

Here we override the attachBaseContext() method to add the Helper.install(MApplication.this); line of code.

Note: Since some of SDK classes now need to be loaded before using, the loading process is done by Helper.install(). Developer needs to invoke this method before using any SDK functionality. Failing to do so will result in unexpected crashes.

Unless the app crashes with java.lang.NoClassDefFoundError: Failed resolution of:….


Update implementation com.google.android.gms:play-services-maps in gradle to a newer version.

That worked for me.


I had a very similar issue, the problem was using an old (deprecated) package, more that 4 years without maintenance. Check your reciently added packages and check if they’re compatible with you Android SDK.


In my case, just cleaning and rebuilding the project worked for me.