Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchFieldError android/support/v7/AppCompat/

After starting my eclipse today, any project I run returns the following error:

08-06 08:01:23.770: E/AndroidRuntime(5406): FATAL EXCEPTION: main
08-06 08:01:23.770: E/AndroidRuntime(5406): Process: be.thomasmore.powerfactory, PID: 5406
08-06 08:01:23.770: E/AndroidRuntime(5406): java.lang.NoSuchFieldError: No static field abc_screen_toolbar of type I in class Landroid/support/v7/appcompat/R$layout; or its superclasses (declaration of 'android.support.v7.appcompat.R$layout' appears in /data/app/be.thomasmore.powerfactory-2/base.apk)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:299)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:246)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at be.thomasmore.powerfactory.MainActivity.onCreate(MainActivity.java:44)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.Activity.performCreate(Activity.java:5990)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.os.Looper.loop(Looper.java:135)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at android.app.ActivityThread.main(ActivityThread.java:5254)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at java.lang.reflect.Method.invoke(Native Method)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at java.lang.reflect.Method.invoke(Method.java:372)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
08-06 08:01:23.770: E/AndroidRuntime(5406):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Last night everything was still working fine..

Any ideas?

like image 381
Glenn Avatar asked Aug 06 '15 12:08

Glenn


3 Answers

Apparently I needed to update my SDK tools and SDK platform-tools, after that I was able to select 5.1.1 as build target for my appcompat v7 library project.

like image 53
Glenn Avatar answered Nov 16 '22 10:11

Glenn


I had a similar problem after upgrading to Android Studio 2.0 and Android Support Library 23.3.0. The error was

java.lang.NoSuchFieldError: No static field AppCompatTheme of type

I solved it by going to Android SDK Manager. Updates were available for following:

  • Android SDK Build Tools
  • Android SDK Tools
  • Android Support Library
  • Google Repository

Updated and ran the app again, that solved the problem.

Edit:

If you have already updated above mentioned things and still have problems, as @mparkes pointed out in comment, check if you have updated the build.gradle(app) file to use the latest library as following:

dependencies {
    compile 'com.android.support:appcompat-v7:23.3.0'
}

Then rebuild the project: Build Menu > Rebuild Project

like image 33
Yogesh Umesh Vaity Avatar answered Nov 16 '22 10:11

Yogesh Umesh Vaity


I also had this problem after upgrading to Android Studio 2.0. In my case it was Instant Run issue. There is a bug in AOSP Issue Tracker.

So disabling Instant Run helped me.

  • Open the Settings or Preferences dialog.
  • Navigate to Build, Execution, Deployment > Instant Run.
like image 5
Oleksandr Avatar answered Nov 16 '22 10:11

Oleksandr