Obsolete
Status Update
Comments
99...@gmail.com <99...@gmail.com> #2
Any update?
99...@gmail.com <99...@gmail.com> #3
Maybe I have located the problem. It's in the method com.android.ant.AaptExecTask.execute in the file com.android.ant.AaptExecTask.java.
So can I just use a fix as below (add a check for the package name) ?
@Override
public void execute() throws BuildException {
...
// execute it.
task.execute();
// now if the project has libraries, R needs to be created for each libraries
// but only if the project is not a library.
try {
if (!mNonConstantId && libPkgProp != null && !libPkgProp.isEmpty()) {
File rFile = new File(mBinFolder, SdkConstants.FN_RESOURCE_TEXT);
if (rFile.isFile()) {
SymbolLoader symbolValues = new SymbolLoader(rFile);
symbolValues.load();
// we have two props which contains list of items. Both items represent
// 2 data of a single property.
// Don't want to use guava's splitter because it doesn't provide a list of the
// result. but we know the list starts with a ; so strip it.
if (libPkgProp.startsWith(";")) {
libPkgProp = libPkgProp.substring(1).trim();
}
String[] packages = libPkgProp.split(";");
String[] rFiles = libRFileProp.list();
if (packages.length != rFiles.length) {
throw new BuildException(String.format(
"%1$s and %2$s must contain the same number of items.",
mLibraryPackagesRefid, mLibraryRFileRefid));
}
for (int i = 0 ; i < packages.length ; i++) {
File libRFile = new File(rFiles[i]);
if (libRFile.isFile()) {
SymbolLoader symbols = new SymbolLoader(libRFile);
symbols.load();
if (! "the packageName in the AndroidManifest.xml of the current project".equals(packages[i])) { // add a check here before the write so it will prevent the overwrite of the R.java generated at some point before it arrives here
SymbolWriter writer = new SymbolWriter(mRFolder, packages[i],
symbols, symbolValues);
writer.write();
}
}
}
}
}
} catch (IOException e) {
throw new BuildException(e);
}
}
99...@gmail.com <99...@gmail.com> #4
Hello! Any update?
Is it OK to make that fix? Or will you fix the bug in the next release (e.g. r22)?
Is it OK to make that fix? Or will you fix the bug in the next release (e.g. r22)?
mm...@gmail.com <mm...@gmail.com> #5
This has become a bottleneck for our project. Could you please update if there is any work around as chnaging package names is not feasible for us. When would the fix be available?
19...@gmail.com <19...@gmail.com> #6
We encountered the same problem, please help to fix it asap.
99...@gmail.com <99...@gmail.com> #7
I just post a change for review: https://android-review.googlesource.com/#/c/47341/
in hope that someone can pay attention about this.
in hope that someone can pay attention about this.
xa...@android.com <xa...@android.com> #8
Apologies to the reporter who took time to contribute a fix. I've done a fix in a parallel that handle more cases. This just went in. I'm planning to release this ASAP.
https://android-review.googlesource.com/#/c/47570/
99...@gmail.com <99...@gmail.com> #9
Thanks! And I have verified the fix for ant task with our project. The fix looks good so far.
By the way, there is another issue pending your fix. It's about the parse for xxhdpi of AndroidManifest.xml. Maybe you have already fix it but not update that issuehttp://code.google.com/p/android/issues/detail?id=39622
By the way, there is another issue pending your fix. It's about the parse for xxhdpi of AndroidManifest.xml. Maybe you have already fix it but not update that issue
da...@gmail.com <da...@gmail.com> #10
I had been having the same issue for the last 2 weeks, and our project is at a halt because of this as well. Thanks a lot for the fix !
I'd appreciate it if someone can please tell me, when will this Fix be released? Will this be part of a SDK Revision 22?
Thanks
I'd appreciate it if someone can please tell me, when will this Fix be released? Will this be part of a SDK Revision 22?
Thanks
xa...@android.com <xa...@android.com> #11
So actually this is not completely fixed.
This works fine if there are 2+ libraries. If there is a single library and its package is the same as the app this will still fail. I'll fix this for 21.1. The other cases (more than one lib, some or all with the same packages) will go live with 21.0.1 which is due any time now.
This works fine if there are 2+ libraries. If there is a single library and its package is the same as the app this will still fail. I'll fix this for 21.1. The other cases (more than one lib, some or all with the same packages) will go live with 21.0.1 which is due any time now.
xa...@android.com <xa...@android.com> #12
21.0.1 fixes this issue partly and was release yesterday afternoon.
As noted above, if you have a single library that shares the app package name, and you build with Ant it will still fails. A workaround is to create a no-op empty 2nd library with the same package name. This will be fixed in the next release.
As noted above, if you have a single library that shares the app package name, and you build with Ant it will still fails. A workaround is to create a no-op empty 2nd library with the same package name. This will be fixed in the next release.
po...@gmail.com <po...@gmail.com> #13
I have encountered a problem with this release 21.0.1, but it's fine in the previous sdk version.
The relation of our projects is like below:
(project type : package name)
app project : app (depends on lib1 and lib2)
lib1 project : lib (depends on lib3)
lib2 project : lib (depends on lib3)
lib3 project : lib (depends on libx)
libx project : libx
During the process of "-code-gen", aapt will generate error messages like...
--------
The following packages have been found to be used by two or more libraries:
lib
No libraries must share the same package, unless all libraries share the same packages.
--------
According to thehttps://android-review.googlesource.com/#/c/47570/ , the "Set<String> duplicatePackages" contains only one duplicate. But it results in BuildException somehow.
Any workaround?
The relation of our projects is like below:
(project type : package name)
app project : app (depends on lib1 and lib2)
lib1 project : lib (depends on lib3)
lib2 project : lib (depends on lib3)
lib3 project : lib (depends on libx)
libx project : libx
During the process of "-code-gen", aapt will generate error messages like...
--------
The following packages have been found to be used by two or more libraries:
lib
No libraries must share the same package, unless all libraries share the same packages.
--------
According to the
Any workaround?
vo...@gmail.com <vo...@gmail.com> #14
I'm running into the exact same issue as #12, with the exception that my app structure is somewhat more streamlined;
libK
libA
libB
libC (depends libA, libB)
libD (depends libC, libK)
libE (depends libD)
App (depends libE)
libK has packagename com.foo.bar, while every other lib and the app has packagename com.fizz.buzz
---
The following packages have been found to be used by two or more libraries:
com.fizz.buzz
No libraries must share the same package, unless all libraries share the same packages.
---
libK
libA
libB
libC (depends libA, libB)
libD (depends libC, libK)
libE (depends libD)
App (depends libE)
libK has packagename com.foo.bar, while every other lib and the app has packagename com.fizz.buzz
---
The following packages have been found to be used by two or more libraries:
com.fizz.buzz
No libraries must share the same package, unless all libraries share the same packages.
---
be...@gmail.com <be...@gmail.com> #15
Hello
Also got the same issue than #12, any idea for a workaround?
Thanks
Benoît
Also got the same issue than #12, any idea for a workaround?
Thanks
Benoît
br...@16cards.com <br...@16cards.com> #16
21.1.0.v201302060044-569685
I am facing an issue where the R.java file generated for the library in the dependent app is not consistent with the R.java generated in the library itself.
An example:
Library generated com.example.lib.R.java:
package com.example.lib;
public final class R {
...
public static final class id {
public static int eula_accept=0x7f090001;
public static int eula_decline=0x7f090002;
public static int eula_webview=0x7f090000;
public static int mainlayout=0x7f090003;
}
...
}
Where as the com.example.lib.R.java generated in the com.example dependent app is:
package com.example.lib;
public final class R {
...
public static final class id {
public static int mainlayout=0x7f090003;
}
...
}
Three IDs completely missing. This is true for layouts colors, etc. There are resource references not making it. This seems like a bug.
I am facing an issue where the R.java file generated for the library in the dependent app is not consistent with the R.java generated in the library itself.
An example:
Library generated com.example.lib.R.java:
package com.example.lib;
public final class R {
...
public static final class id {
public static int eula_accept=0x7f090001;
public static int eula_decline=0x7f090002;
public static int eula_webview=0x7f090000;
public static int mainlayout=0x7f090003;
}
...
}
Where as the com.example.lib.R.java generated in the com.example dependent app is:
package com.example.lib;
public final class R {
...
public static final class id {
public static int mainlayout=0x7f090003;
}
...
}
Three IDs completely missing. This is true for layouts colors, etc. There are resource references not making it. This seems like a bug.
Description
- 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!