Closed Bug 1084522 Opened 10 years ago Closed 10 years ago

Attribute "layout" has already been defined

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox34 fixed, firefox35 fixed, firefox36 fixed)

RESOLVED FIXED
Firefox 36
Tracking Status
firefox34 --- fixed
firefox35 --- fixed
firefox36 --- fixed

People

(Reporter: rnewman, Assigned: rnewman)

References

Details

Attachments

(2 files, 3 obsolete files)

mobile/android/base/resources/values/attrs.xml:109: error: Attribute "layout" has already been defined
This patch renames some "layout" occurrences to "geckolayout" and "buttonlayout" to avoid colliding with -- I presume -- the v7 support library.

This has been reported all over the web. In our case, renaming seems like a fine solution.

Let me know if there's an approach you prefer. This got things building.
Attachment #8507229 - Flags: review?(lucasr.at.mozilla)
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Patch ain't complete:

E/GeckoAppShell( 9370): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 1 ("main")
E/GeckoAppShell( 9370): java.lang.RuntimeException: You must supply buttonlayout attribute
E/GeckoAppShell( 9370):         at org.mozilla.gecko.widget.IconTabWidget.<init>(IconTabWidget.java:37)
E/GeckoAppShell( 9370):         at java.lang.reflect.Constructor.constructNative(Native Method)
E/GeckoAppShell( 9370):         at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.createView(LayoutInflater.java:594)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.inflate(LayoutInflater.java:462)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/GeckoAppShell( 9370):         at org.mozilla.gecko.tabs.TabsPanel.inflateLayout(TabsPanel.java:149)
E/GeckoAppShell( 9370):         at org.mozilla.gecko.tabs.TabsPanel.<init>(TabsPanel.java:122)
E/GeckoAppShell( 9370):         at java.lang.reflect.Constructor.constructNative(Native Method)
E/GeckoAppShell( 9370):         at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.createView(LayoutInflater.java:594)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
E/GeckoAppShell( 9370):         at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/GeckoAppShell( 9370):         at android.view.ViewStub.inflate(ViewStub.java:259)
E/GeckoAppShell( 9370):         at org.mozilla.gecko.BrowserApp.ensureTabsPanelExists(BrowserApp.java:1712)
Missed the references. This builds. mgoodwin, please test?
Attachment #8507541 - Flags: review?(lucasr.at.mozilla)
Attachment #8507229 - Attachment is obsolete: true
Attachment #8507229 - Flags: review?(lucasr.at.mozilla)
Not working for me, still. Patches queued:
$ hg qser
0 A attachment.cgi?id=8507204
1 A attachment.cgi?id=8507228
2 A attachment.cgi?id=8507541

Relevant (I think) logcat:
E/GeckoAppShell(10752): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 1 ("main")
E/GeckoAppShell(10752): java.lang.RuntimeException: You must supply buttonlayout attribute
E/GeckoAppShell(10752):         at org.mozilla.gecko.widget.IconTabWidget.<init>(IconTabWidget.java:37)
E/GeckoAppShell(10752):         at java.lang.reflect.Constructor.constructNative(Native Method)
E/GeckoAppShell(10752):         at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.createView(LayoutInflater.java:594)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.inflate(LayoutInflater.java:462)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
E/GeckoAppShell(10752):         at org.mozilla.gecko.tabs.TabsPanel.inflateLayout(TabsPanel.java:149)
E/GeckoAppShell(10752):         at org.mozilla.gecko.tabs.TabsPanel.<init>(TabsPanel.java:122)
E/GeckoAppShell(10752):         at java.lang.reflect.Constructor.constructNative(Native Method)
E/GeckoAppShell(10752):         at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.createView(LayoutInflater.java:594)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
E/GeckoAppShell(10752):         at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
E/GeckoAppShell(10752):         at android.view.ViewStub.inflate(ViewStub.java:259)
E/GeckoAppShell(10752):         at org.mozilla.gecko.BrowserApp.ensureTabsPanelExists(BrowserApp.java:1712)
E/GeckoAppShell(10752):         at org.mozilla.gecko.BrowserApp.access$1700(BrowserApp.java:133)
E/GeckoAppShell(10752):         at org.mozilla.gecko.BrowserApp$33.run(BrowserApp.java:1606)
E/GeckoAppShell(10752):         at android.os.Handler.handleCallback(Handler.java:730)
E/GeckoAppShell(10752):         at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoAppShell(10752):         at android.os.Looper.loop(Looper.java:137)
E/GeckoAppShell(10752):         at android.app.ActivityThread.main(ActivityThread.java:5103)
E/GeckoAppShell(10752):         at java.lang.reflect.Method.invokeNative(Native Method)
E/GeckoAppShell(10752):         at java.lang.reflect.Method.invoke(Method.java:525)
E/GeckoAppShell(10752):         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/GeckoAppShell(10752):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/GeckoAppShell(10752):         at dalvik.system.NativeStart.main(Native Method)
namespacing fixed the problem for me. E.g: buttonlayout="@layout/tabs_panel_indicator" becomes: gecko:buttonlayout="@layout/tabs_panel_indicator"
Tested on Nexus 10 with new and old tablet UI, and phone.

Doesn't mean it's *right*, but it builds and runs.
Attachment #8507586 - Flags: review?(lucasr.at.mozilla)
Attachment #8507541 - Attachment is obsolete: true
Attachment #8507541 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 8507586 [details] [diff] [review]
Don't redefine layout attribute in IconTabWidget. v3

Review of attachment 8507586 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/base/resources/values/attrs.xml
@@ +105,5 @@
>          </attr>
>      </declare-styleable>
>  
>      <declare-styleable name="TabCounter">
> +        <attr name="geckolayout" format="reference"/>

We should just reuse android:layout here.

@@ +156,5 @@
>          <attr name="doinit" format="boolean"/>
>      </declare-styleable>
>  
>      <declare-styleable name="IconTabWidget">
> +        <attr name="buttonlayout" format="reference"/>

This change is not necessary. Reusing android:layout won't cause any problems.
Attachment #8507586 - Flags: review?(lucasr.at.mozilla) → feedback+
Using android:layout:

22:29.48 /Users/rnewman/moz/hg/fx-team/mobile/android/base/resources/values/attrs.xml:109: error: Attribute "android:layout" has already been defined
22:29.48
22:29.48 /Users/rnewman/moz/hg/fx-team/mobile/android/base/resources/values/attrs.xml:160: error: Attribute "android:layout" has already been defined
This builds.

I had to remove the format argument to avoid a build error. (We're shadowing a declaration from elsewhere, and apparently they have to match.)
Attachment #8508071 - Flags: review?(lucasr.at.mozilla)
Attachment #8507586 - Attachment is obsolete: true
Attachment #8508071 - Flags: review?(lucasr.at.mozilla) → review+
(In reply to Richard Newman [:rnewman] from comment #9)
> Created attachment 8508071 [details] [diff] [review]
> Don't redefine layout attribute in IconTabWidget. v4
> 
> This builds.
> 
> I had to remove the format argument to avoid a build error. (We're shadowing
> a declaration from elsewhere, and apparently they have to match.)

Yeah, sorry, I should have mentioned that you shouldn't specify format when reusing an android attribute.
https://hg.mozilla.org/mozilla-central/rev/caaa0cc9b53d
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 36
Comment on attachment 8508071 [details] [diff] [review]
Don't redefine layout attribute in IconTabWidget. v4

Approval Request Comment
[Feature/regressing bug #]:
  New tablet work plus old code, in combination with newer Android tools.

[User impact if declined]:
  Developers can't build Aurora or Beta with new Android tools.

[Describe test coverage new/current, TBPL]:
  N/A

[Risks and why]: 
  Low risk; avoid name collision.

[String/UUID change made/needed]:
  None.
Attachment #8508071 - Flags: approval-mozilla-beta?
Attachment #8508071 - Flags: approval-mozilla-aurora?
Comment on attachment 8508071 [details] [diff] [review]
Don't redefine layout attribute in IconTabWidget. v4

Beta+
Aurora+
Attachment #8508071 - Flags: approval-mozilla-beta?
Attachment #8508071 - Flags: approval-mozilla-beta+
Attachment #8508071 - Flags: approval-mozilla-aurora?
Attachment #8508071 - Flags: approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: