Closed Bug 932642 Opened 11 years ago Closed 10 years ago

[GeckoView] Resources id issue when build with gradle

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: pengjianqing, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36

Steps to reproduce:

When I use the GeckoView library and integrated with gradle build.
The GeckoViewExample running will crash, because of the resources id problem in another project.
So I test and retry, and find if I fix the code of get resources in gfx/LayerRenderer.java and ThumbnailHelper.java, it will be fine.
Attachment #824417 - Attachment is patch: true
Attachment #824417 - Attachment mime type: text/x-patch → text/plain
Attachment #824417 - Flags: review?(mark.finkle)
Comment on attachment 824417 [details] [diff] [review]
resources_id_patch.diff

This looks OK to me, but I want Brian to take a look too.
Attachment #824417 - Flags: review?(mark.finkle)
Attachment #824417 - Flags: review?(bnicholson)
Attachment #824417 - Flags: review+
Comment on attachment 824417 [details] [diff] [review]
resources_id_patch.diff

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

This makes no sense.  What this says is that the compiled org.mozilla.gecko.R is not up-to-date (since the generated resource IDs found at compile time don't match with the resource IDs found at runtime.)  I don't know what the gradle configuration looks like, but this will only improve things when that build configuration is incorrect.

My guess is that gradle is generating an R.java that is not including the correct resources for GeckoView together with the enclosing App.  I saw this issue in the context of making Eclipse compile Fennec; the way I addressed this is non-trivial: Bug 934646.  I really don't know how to address this; I haven't tried to understand how GeckoView-using Apps get built.  I could see this being hairy.

But whatever else, this is papering over a build/configuration error.
Attachment #824417 - Flags: review?(bnicholson) → review-
I had to do something similar to this will initially landing GeckoView. The GeckoView R.java file and the embedding application R.java file were colliding and no amount of AAPT trickery was getting it fixed.

https://bug880118.bugzilla.mozilla.org/attachment.cgi?id=797273
I'm going to close this, because Bug 978587 addresses exactly this issue.

Namely: GeckoView is packaged as the Android library "org.mozilla.gecko".  The resource mapping "org.mozilla.gecko.R" includes both the library resources *and* the embedding application resources.  In practice, this means that the org/mozilla/gecko/R.java *must* be generated by the embedding application.

At various times in the past, we shipped our own org.mozilla.gecko.R, which was only correct due to luck.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
For anybody else building with Gradle, make sure you read

http://www.ncalexander.net/blog/2014/07/10/build-your-own-browser-a-maven-repository-for-geckoview/
OS: Mac OS X → Android
Hardware: x86 → All
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

Creator:
Created:
Updated:
Size: