Search code examples
androidandroid-activityandroid-actionbarandroid-actionbar-compatandroid-appcompat

Issue with ActionBarActivityDelegate class.....app doesn't run


Hello i hope someone can help me with his I was planning to put an action bar in my test app, so I did exactly as said in the developers API guide.

But when i tried to compile it it throw this error (logcat):

java.lang.ExceptionInInitializerError
at android.support.v7.app.ActionBarActivityDelegate.createDelegate()
at android.support.v7.app.ActionBarActivity.onCreate().....
..... 
Caused by: java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr
at android.support.v7.app.ActionBarActivityDelegateBase.<clinit>

What happens is that the app is correctly installed into my phone but even before it shows any UI, it throws the error and closes.

I even tried with the most simple app ("hello world example") and says the same thing I tried it in both real phone and simulator, and same result

Any ideas how to fix that???? Seems that there is no definition for the class ActionBarActivityDelegateBase, but i cannot find any reference to that class in the guides or any other website


Solution

  • I had that error, and the problem was that I hadn't added the lib with the resources. You can't just add the jars, because it will not add the resources. You have to create a project from thoses libs and then add the project as a library to your own project.

    Here's the instructions how to:

    Go to this link and go to the "Adding libraries with resources" section

    http://developer.android.com/tools/support-library/setup.html

    This fixed the problem for me.

    Cheers