From f369217000a89786369810a177e3404f103c4874 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Tue, 28 Feb 2012 11:45:25 -0800 Subject: 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 --- .../adt/internal/build/builders/PostCompilerBuilder.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'eclipse') 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; } -- cgit v1.1