Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Attribute "title" has already been defined

I want to add 2 or more Library into my project.

  1. Actionbar
  2. Actionbar Sherlock
  3. Facebook SDK
  4. google-play-sevices
  5. Date picker library

I added this library into my project but i getting error like.

D:\workspace\workspace\actionbarsherlock\res\values\abs__attrs.xml:209: error: Attribute "title" has already been defined

I think here problem with Actionbar & Actionbar Sherlock library in same name of title but i don't know how to fix this.

Please tell me how to fix that.

like image 710
Jigar Shekh Avatar asked Feb 23 '14 13:02

Jigar Shekh


2 Answers

Actionbar Sherlock is a library project, i think you can edit "title" in abs__attrs.xml and call it something else "title1"! so don't forget to replace all title occurrences by CMD+R or find eclipse function.

like image 182
Smile2Life Avatar answered Nov 15 '22 11:11

Smile2Life


If you have the source code and don't want to change their original's name, the following is a alternative solution: 1.declare the defined attr at the begin of xml file instead of in one set. 2. reference the declared attr without format (it's already defined in step 1, don't defined again) inside of one set.

Now it's done. Here is an sample.

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <attr name="icon" format="integer" />
   <declare-styleable name="PreferenceHeader" >
      <!-- Identifier value for the header. -->
      < attr name="id" format="integer"/>
      < attr name="icon" />
  </declare-styleable >

  <declare-styleable name="Preference" >
      < attr name= "icon"/>
      <!-- The key to store the Preference value. -->
      < attr name="key" format ="string" />
  </declare-styleable >
</resources>
like image 3
Sysphus Avatar answered Nov 15 '22 12:11

Sysphus