Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: java.land.NoSuchFieldError after update to SDK 23

I updated to SDK 23 and updated the gradle.build to API 23, support library to 23.0.0, etc and am now getting the following error when trying to run the app (compiles just fine).

java.lang.NoSuchFieldError: No instance field mFragments of type Landroid/support/v4/app/FragmentManagerImpl; in class Landroid/support/v4/app/Watson; or its superclasses (declaration of 'android.support.v4.app.Watson' appears in /data/app/com.my.app-1/base.apk)
            at android.support.v4.app.Watson.onCreatePanelMenu(Watson.java:50)
            at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:560)
            at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:64)
            at com.actionbarsherlock.app.SherlockFragmentActivity.onCreatePanelMenu(SherlockFragmentActivity.java:164)
            at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:548)
            at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:917)
            at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:258)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

I reverted back to API 22 on everything and still get the error.

like image 586
mraviator Avatar asked Aug 18 '15 17:08

mraviator


3 Answers

I did the some thing as you did , but I found gradle can solve dependencies, in External Libraries i cannot find support-v4-23.0.0,support-v7-23.0.0 and other lib which the version is 23.0.0. then I reverted back to compile 'com.android.support:support-v4:22.2.0', the problem solver @mraviator

like image 161
sanemars Avatar answered Nov 04 '22 09:11

sanemars


Thank you @zmarties for the answer , I want to add the details and links

  1. Remove 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' from gradle
  2. Download actionbarsherlock module from this link!
  3. Verify that you have 'com.android.support:support-v4:20.0.0' or 23
  4. Open the actionbarsherlock module src change FloatMath to Math in AnimatorProxy.java
  5. Open the actionbarsherlock module src create variable fragments in class level scope as FragmentManagerImpl fragments = (FragmentManagerImpl) this.getSupportFragmentManager(); in Watson.java
  6. Replace all mFragments occurrence with fragments variable

Thank you for the above answers .

like image 12
Subtain Ishfaq Avatar answered Nov 04 '22 10:11

Subtain Ishfaq


Using google play services version 8.1.0 instead of 8.4.0 solved on my side

like image 6
ergunkocak Avatar answered Nov 04 '22 10:11

ergunkocak