Now you can merge the library manifest files to the main app's
AndroidManifest.xml with LOCAL_FULL_LIBS_MANIFEST_FILES.
LOCAL_FULL_LIBS_MANIFEST_FILES is a list of paths relative to the top of
the source tree.
Bug: 12907528
Change-Id: I16a347c83dfb6fbbb7d5d40284b7c65aa682fdd2
1. Let aapt output the proguard_options file
2. If proguard is enabled, switch the dependency from
$(full_classes_jar) to $(full_classes_proguard_jar).
Change-Id: Idc641a1515b8899a4623a2aeec5cd494f6c1c1c5
- Usually you don't need to set LOCAL_JAR_EXCLUDE_FILES in your
Android.mk, if your static library is directly used by an app.
- If your library will be included by another library that need
reference the R/Manifest class, you can set
LOCAL_JAR_EXCLUDE_FILES := none
to keep the generated classes.
- If your library includes another static library that has Android
resource and you want to remove the generated classes carried by
the static library, set:
LOCAL_JAR_EXCLUDE_FILES := $(ANDROID_RESOURCE_GENERATED_CLASSES)
With the LOCAL_JAR_EXCLUDE_FILES value "none", deprecate the old
long variable LOCAL_KEEP_R_CLASS_IN_STATIC_JAVA_LIBRARY.
Change-Id: I3b9ad5d66f0262f784feb09bc1537c5b01256258
Bug: 6465084
With this change and prebuilt current SDK checked in, you can build
unbundled apps with LOCAL_SDK_VERSION current in an unbundled branch.
Change-Id: I4efcee611d08a3a903bd6bf5a80de11500564206
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
Bug: 5714516
The rationale behind this change:
- the library is compiled into a jar file, but its R class is generated
making the constant not constant (static, not final static) (aapt
option --non-constant-id). Also the jar file does not contain the R
class.
- this allows the integer value to not be inlined in the compiled
class files. Note that this prevents using switch statements.
- the main project use this jar file as a normal static library: it will
add all the class files except the R.class.
- the main project uses the library res folder as a resource
folder with lower priority than the main project (basically the
main project is an overlay. This is accomplished using aapt's
--auto-add-overlay to handle resources only in the main project
(which the normal overlay mechanism doesn't allow).
- the main project creates R classes in the main project's
package but also in the library's package. This is done with
aapt's --extra-packages which accept as many packages as
needed, separated by a :.
- manifest merging is not done yet, so
activities/services/permissions/etc... have to be manually declared in
the main app.
To use a static library with Android resource in your app,
1. Add the library's resource dir to your app as an overlay:
LOCAL_RESOURCE_DIR := <app_resource_dir> <static_library_resource_dirs>
2. Set the proper aapt flags:
LOCAL_AAPT_FLAGS := <apps_own_flags> --auto-add-overlay \
--extra-packages <lib1_package_name>:<lib2_package_name>:...
Change-Id: Ifb4d2300b952ea4aaee74da1bb0c6c72ea0698a3