I am updating an app from API 9 to API 28 which implemented ActionBarSherlock. I have been following many tutorials (specially this one) to upgrade from ActionBarSherlock to ActionBarActivity and tweaked them a little bit to update the ActionBarActivity to AppCompatActivity.
The problem I have is that after the full upgrading, I am having a runtime crash with one of the attrs of the ActionBarSherlock that I seem not be able to delete, or override, as it is being used by appcompat v7.
java.lang.NoSuchFieldError: No static field ActionBar_displayOptions of type I in class Landroid/support/v7/appcompat/R$styleable; or its superclasses (declaration of 'android.support.v7.appcompat.R$styleable' appears in /data/app/com.android.app-OJqieQQnVdzAHNjYAKgnhA==/split_lib_slice_0_apk.apk)
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:133)
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:96)
at android.support.v7.widget.Toolbar.getWrapper(Toolbar.java:2112)
at android.support.v7.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:547)
at android.support.v7.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:539)
at android.support.v7.widget.ActionBarOverlayLayout.setWindowCallback(ActionBarOverlayLayout.java:615)
at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:611)
at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.android.app.ui.activity.LoginActivity.onCreate(LoginActivity.java:40)
And checking the abs__attrs.xml file I can see that attr:
<attr name="displayOptions">
<flag name="useLogo" value="0x1" />
<flag name="showHome" value="0x2" />
<flag name="homeAsUp" value="0x4" />
<flag name="showTitle" value="0x8" />
<flag name="showCustom" value="0x10" />
<flag name="disableHome" value="0x20" />
</attr>
If I deleted or change it's name, the compiler complains and doesn't lets me run build the project - but it should get the field from the v7 support library, right?
Any way, I have tried changing the theme of the activity to
"android:theme=@style/Theme.AppCompat.Light.NoActionBar"
and I get it to load, without the ActionBar, so I am guessing here that the problem is indeed something related with the ActionBar. Any ideas?
Cheers!
Problem was with the support library, downloading it again fixed the issue!