Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchFieldError: android.support.v7.appcompat

I updated my support library from r20 to r21, now when I run my app I get this error in super.onCreate of my main activity :

java.lang.NoSuchFieldError: android.support.v7.appcompat.R$styleable.Theme_windowActionBar
    at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:145)
    at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:139)
    at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123)
    at (packageName).Main.onCreate(Main.java:64)
    at android.app.Activity.performCreate(Activity.java)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
    at android.app.ActivityThread.access$700(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
    at android.os.Handler.dispatchMessage(Handler.java)
    at android.os.Looper.loop(Looper.java)
    at android.app.ActivityThread.main(ActivityThread.java)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    at dalvik.system.NativeStart.main(Native Method)

my theme.xml :

<style name="AppBaseTheme" parent="Theme.AppCompat">
</style>

<style name="AppTheme" parent="AppBaseTheme">
    <item> ... </item>
</style>

in manifest :

android:theme="@style/AppTheme"

what is the problem ?

thanks

like image 268
Saeed.re Avatar asked Oct 19 '22 23:10

Saeed.re


1 Answers

It happened same to me when I update SDK. If you have version 21 of library "Android Support Library" this bug occurs. I don't know what is the reason but last release make this bug.

You can solve it by downloading previous version of "Android Support Library" (r20) from here: https://dl-ssl.google.com/android/repository/support_r20.zip, and using it in your project.

You are welcome!

like image 70
willywonka87 Avatar answered Oct 27 '22 18:10

willywonka87