Question

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

Was it helpful?

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

OTHER TIPS

I had the same issue about 20 minutes ago. I fixed it in the Manifest by changing the theme from "AppTheme" to "Theme.AppCompat"

<application
    ...
    android:theme="@style/Theme.AppCompat" >

I'm using Android-Studio 1.0.2 and I had the same problem. I fixed the issue removing compile 'com.google.android.gms' from build.gradle. Not too sure about the cause of the problem.

I spent a whole day trying to fix this. I am using eclipse on debian. I ended up adding the library android-support-v7-appcompt and my app into one working set and built the "working set" to resolve the issue. This eventually created the necessary files in android-support-v7-appcompat/bin folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top