Remove the R/Manifest classes when building the static Java library
Bug: 5448433
Instead of deferring the removal to building the app.
In that case any R/Manifest classes in any static Java libraries will be
deleted, no matter if they are generated from Android resource, or just
source R.java/Manifest.java in the source tree by accident.
Change-Id: I656f45e3cbc3796c5d4832363231480b3f1dc5b8
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 3a1925d..d317691 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -34,6 +34,13 @@
) \
) \
))
+
+ifneq (,$(all_resources))
+# Those files will be excluded from the built jar.
+# The R/Manifest classes should be re-generated in the app Module instead.
+# Use '' and $ escape because they will be passed to bash.
+LOCAL_JAR_EXCLUDE_FILES := 'R.class' 'R$$*.class' 'Manifest.class' 'Manifest$$*.class'
+endif
endif
include $(BUILD_SYSTEM)/java_library.mk
@@ -93,3 +100,4 @@
endif # $(all_resources) not empty
LOCAL_IS_STATIC_JAVA_LIBRARY :=
+LOCAL_JAR_EXCLUDE_FILES :=