Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Use Markdown for this comment
Set severity, which reflects how much the issue affects the use of the product
Change issue status back to 'Assigned'
Pending code changes (auto-populated)
[ID: 84651]
Select items in the list
[ID: 558956]
[ID: 874707]
Set the version(s) of the product affected by this issue (comma-separated list)
Set the version(s) of the product in which the issue should be fixed (comma-separated list)
Set the version(s) of the product in which the issue fix was verified (comma-separated list)
Set if this issue occurs in production
[ID: 85206]
Set Reporter
Set Type
Set priority, which reflects how soon the issue should be fixed
Set Status
Set Assignee
Set Verifier
Remove item
View or edit staffing
View issue level access limits(Press Alt + Right arrow for more information)
Description
#1- Steps to reproduce the problem (including sample code if appropriate).
(1) The attachment bug_android_sdk_21.zip contains 2 sample projects: y and ylib.
(2) Project y depends on project ylib. These 2 projects use the same package name "com.y" in their AndroidManifest.xml.
(3) Define a string in project y/res/values/strings.xml: str_y.
(4) Define an Activity in project y/src/com/y/HomeActivity.java and this activity reference the string stry_y.
- What happened.
(1) In command line, run "ant debug" and will get the error messages as below:
-compile:
[javac] Compiling 3 source files to /home/somewhere/y/bin/classes
[javac] /home/somewhere/y/src/com/y/HomeActivity.java:12: cannot find symbol
[javac] symbol : variable str_y
[javac] location: class com.y.R.string
[javac] setTitle(R.string.str_y);
[javac] ^
[javac] 1 error
(2) While check the y/gen/com/y/R.java, I found the str_y is not generated. All the resources id in y/gen/com/y/R.java actually reference the resources in the library project ylib/res.
(3) The Eclipse ADT can successfully build the attached project with no problem.
- What you think the correct behavior should be.
The ant build should treat the project the same way as the Eclipse.
It's true if I change the library project with a different package name in the AndroidManifest.xml, then I can build it successfully. But this is painful for some big projects rather than the sample projects because we have to tweak all the xxx.R import in the library projects and some of the feature we implemented rely on the "resource override" behavior: e.g. lib project is shared by several app projects and lib define some layout layout_abc.xml, A and B projects all have defined their own layout_abc.xml. And the java code in lib project reference the layout_abc. For this use case, all the related source code will have to be refactored.
This subtle bug is bad. Please fix this as soon as possible.
And it would be great if you can give us some advice or workaround (e.g. turn on some option using some properties so we can use the same way to build by ant).
Thanks!