diff options
author | Xavier Ducrohet <xav@android.com> | 2012-02-28 11:45:25 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-02-28 11:45:25 -0800 |
commit | f369217000a89786369810a177e3404f103c4874 (patch) | |
tree | 8a8c1e5ee1dc4b4b9403061c6e1accc7d2328074 /eclipse | |
parent | 0a5104e923c10167af41c5f2b644a49116294cea (diff) | |
download | sdk-f369217000a89786369810a177e3404f103c4874.zip sdk-f369217000a89786369810a177e3404f103c4874.tar.gz sdk-f369217000a89786369810a177e3404f103c4874.tar.bz2 |
Never add R/R$* classes to the library jar files.
Previous change added excluding Manifest and BuildConfig but
made it so that it was only for the current app package.
The problem is that project that depends on libraries also generates
R classes for their libraries.
If the project itself is a library then the R classes from the libraries
would get in the library jar output.
If the main project had some diamond dependencies in its libraries
then the same R class from a library could be added twice to its
dex input causing an error.
Change-Id: I0ef4a3c3f84bf9099de27e275fa856b6c044978d
Diffstat (limited to 'eclipse')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java index c61f738..d65dedf 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java @@ -815,11 +815,13 @@ public class PostCompilerBuilder extends BaseBuilder { rootFolder.getFullPath()); String name = file.getName(); - // we don't package any R[$*] classes or buildconfig - if (mAppPackage.equals(packageApp.toString()) && - (BUILD_CONFIG_CLASS.equals(name) || - MANIFEST_PATTERN.matcher(name).matches() || - R_PATTERN.matcher(name).matches())) { + // we don't package any R[$*] classes whatever the package (because we generate + // more than one if there are library dependencies). Also ignore Manifest and + // BuildConfig classes that are in the app package. + if (R_PATTERN.matcher(name).matches() || + (mAppPackage.equals(packageApp.toString()) && + (BUILD_CONFIG_CLASS.equals(name) || + MANIFEST_PATTERN.matcher(name).matches()))) { return; } |