Android – Error:(254) Attribute “background” already defined with incompatible format

actionbarsherlockandroidandroid-appcompat

In my old project i have use roboguice-sherlock and actionbarsherlock, now i also want to implement com.android.support:appcompat-v7 and com.android.support:design but when i am trying to add this two dependencies in gradle i got this error given below.
I have also try to replace it but in some case it is compulsory to use sherlock

Error:(254) Attribute "background" already defined with incompatible format.
Error:(130) Original attribute defined here.
Error:(481) Attribute "navigationMode" already defined with incompatible format.
Error:(241) Original attribute defined here.
Error:(489) Attribute "displayOptions" already defined with incompatible format.
Error:(247) Original attribute defined here.
Error:(502) Attribute "itemBackground" already defined with incompatible format.
Error:(474) Original attribute defined here.
Error:(505) Attribute "actionBarSize" already defined with incompatible format.
Error:(297) Original attribute defined here.
Error:(507) Attribute "windowMinWidthMajor" already defined with incompatible format.
Error:(296) Original attribute defined here.
Error:(507) Attribute "windowMinWidthMinor" already defined with incompatible format.
Error:(296) Original attribute defined here.
Error:(254) Attribute "background" already defined with incompatible format.
Error:(130) Original attribute defined here.
Error:(481) Attribute "navigationMode" already defined with incompatible format.
Error:(241) Original attribute defined here.
Error:(489) Attribute "displayOptions" already defined with incompatible format.
Error:(247) Original attribute defined here.
Error:(502) Attribute "itemBackground" already defined with incompatible format.
Error:(474) Original attribute defined here.
Error:(505) Attribute "actionBarSize" already defined with incompatible format.
Error:(297) Original attribute defined here.
Error:(507) Attribute "windowMinWidthMajor" already defined with incompatible format.
Error:(296) Original attribute defined here.
Error:(507) Attribute "windowMinWidthMinor" already defined with incompatible format.
Error:(296) Original attribute defined here.

Best Answer

To replace roboguice-sherlock to AppCompat :

1). Remove all code which contain action bar

2). Download https://github.com/rtyley/roboguice-sherlock source code and put this packge com.github.rtyley.android.sherlock hard coded code in project

3). Remove dependencies :

1. compile 'com.github.rtyley:roboguice-sherlock:1.5'
2. compile 'com.actionbarsherlock:actionbarsherlock:4.4.0aar' 

4). add dependencies :

1. compile 'com.android.support:appcompat-v7:25.0.1'
2. compile 'com.android.support:design:25.0.1'

5). Change some file extandes to in roboguice-sherlock

1. class SherlockAccountAuthenticatorActivity extends AppCompatActivity
2. class RoboSherlockActivity extends AppCompatActivity
3. class RoboSherlockFragmentActivity extends FragmentActivity
4. class RoboSherlockListActivity extends ListActivity
5. class RoboSherlockPreferenceActivity extends PreferenceActivity
6. class RoboSherlockDialogFragment extends DialogFragment
7. class RoboSherlockFragment extends Fragment
8. class RoboSherlockListFragment extends ListFragment

6). AppCompat is ready. Now you can customise all in appCompat.

Related Topic