问题描述
在我的旧项目中,我使用了 roboguice-sherlock
和 actionbarsherlock
,现在我也想实现 com.android.support:appcompat-v7
和 com.android.support:design
,但是当我尝试添加这两个在gradle中的依赖项我在下面给出了此错误。
我也尝试替换它,但在某些情况下,必须使用 sherlock
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.
推荐答案
替换 roboguice-sherlock 到 AppCompat :
1)。删除所有包含操作栏的代码
1). Remove all code which contain action bar
2)。下载源代码并将其打包 com.github.rtyley.android.sherlock 项目中的硬编码
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)。删除依赖项:
1. compile 'com.github.rtyley:roboguice-sherlock:1.5'
2. compile 'com.actionbarsherlock:actionbarsherlock:4.4.0aar'
4)。添加依赖项:
1. compile 'com.android.support:appcompat-v7:25.0.1'
2. compile 'com.android.support:design:25.0.1'
5)。在 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准备就绪。现在,您可以在appCompat中自定义所有内容。
6). AppCompat is ready. Now you can customise all in appCompat.
这篇关于错误:(254)属性“背景”;已经使用不兼容的格式定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!