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

I updated my support library from r20 to r21, now when I run the application, I get this error in super.onCreate 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

+5
source share
3 answers

The same thing happened to me when I update the SDK. If you have version 21 of the Android Support Library, this error occurs. I don't know what the reason is, but the latest release makes this mistake.

You can solve this problem by downloading the previous version of the โ€œAndroid Support Libraryโ€ (r20) here: https://dl-ssl.google.com/android/repository/support_r20.zip and using it in your project.

Welcome!

+2
source

I compared support_v7_appcompat (version 20) with support_v7_appcompat (version 21). In res/values/attrs.xml (version 21), the windowActionBar attributes windowActionBar not in <declare-styleable name="Theme">

+1
source

if you use intellij => you need to add / strutures / modules / modules> = YOURSDK \ extras \ android \ support \ v7 \ appcompat and add to your project for example, you always have the latest support

0
source

Source: https://habr.com/ru/post/1205869/


All Articles