Android Build System (Android PDK)_the local_src_files for a prebuilt library should -程序员宅基地

技术标签: Linux/Android  

Android Build System

Android uses a custom build system to generate tools, binaries, and documentation. This document provides an overview of Android's build system and instructions for doing a simple build.

Android's build system is make based and requires a recent version of GNU Make (note that Android uses advanced features of GNU Make that may not yet appear on the GNU Make web site). Before continuing, check your version of make by running % make -v. If you don't have version 3.80 or greater, you need toupgrade your version of make.

Understanding the makefile

A makefile defines how to build a particular application. Makefiles typically include all of the following elements:

  1. Name: Give your build a name (LOCAL_MODULE := <build_name>).
  2. Local Variables: Clear local variables with CLEAR_VARS (include $(CLEAR_VARS)).
  3. Files: Determine which files your application depends upon (LOCAL_SRC_FILES := main.c).
  4. Tags: Define tags, as necessary (LOCAL_MODULE_TAGS := eng development).
  5. Libraries: Define whether your application links with other libraries (LOCAL_SHARED_LIBRARIES := cutils).
  6. Template file: Include a template file to define underlining make tools for a particular target (include $(BUILD_EXECUTABLE)).

The following snippet illustrates a typical makefile.

LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := <buil_name>
LOCAL_SRC_FILES := main.c
LOCAL_MODULE_TAGS := eng development
LOCAL_SHARED_LIBRARIES := cutils
include $(BUILD_EXECUTABLE)
(HOST_)EXECUTABLE, (HOST_)JAVA_LIBRARY, (HOST_)PREBUILT, (HOST_)SHARED_LIBRARY,
  (HOST_)STATIC_LIBRARY, PACKAGE, JAVADOC, RAW_EXECUTABLE, RAW_STATIC_LIBRARY,
  COPY_HEADERS, KEY_CHAR_MAP

The snippet above includes artificial line breaks to maintain a print-friendly document.

Layers

The build hierarchy includes the abstraction layers described in the table below.

Each layer relates to the one above it in a one-to-many relationship. For example, an arch can have more than one board and each board can have more than one device. You may define an element in a given layer as a specialization of an element in the same layer, thus eliminating copying and simplifying maintenance.

Layer Example Description
Product myProduct, myProduct_eu, myProduct_eu_fr, j2, sdk The product layer defines a complete specification of a shipping product, defining which modules to build and how to configure them. You might offer a device in several different versions based on locale, for example, or on features such as a camera.
Device myDevice, myDevice_eu, myDevice_eu_lite The device layer represents the physical layer of plastic on the device. For example, North American devices probably include QWERTY keyboards whereas devices sold in France probably include AZERTY keyboards. Peripherals typically connect to the device layer.
Board sardine, trout, goldfish The board layer represents the bare schematics of a product. You may still connect peripherals to the board layer.
Arch arm (arm5te) (arm6), x86, 68k The arch layer describes the processor running on your board.

Building the Android Platform

This section describes how to build the default version of Android. Once you are comfortable with a generic build, then you can begin to modify Android for your own target device.

Device Code

To do a generic build of android, source build/envsetup.sh, which contains necessary variable and function definitions, as described below.

% cd $TOP

% . build/envsetup.sh

# pick a configuration using choosecombo
% choosecombo

% make -j4 PRODUCT-generic-user

You can also replace user with eng for a debug engineering build:

% make -j4 PRODUCT-generic-eng

These Build Variants differ in terms of debug options and packages installed.

Cleaning Up

Execute % m clean to clean up the binaries you just created. You can also execute % m clobber to get rid of the binaries of all combos. % m clobber is equivalent to removing the //out/ directory where all generated files are stored.

Speeding Up Rebuilds

The binaries of each combo are stored as distinct sub-directories of //out/, making it possible to quickly switch between combos without having to recompile all sources each time.

However, performing a clean rebuild is necessary if the build system doesn't catch changes to environment variables or makefiles. If this happens often, you should define the USE_CCACHE environment variable as shown below:

% export USE_CCACHE=1

Doing so will force the build system to use the ccache compiler cache tool, which reduces recompiling all sources.

ccache binaries are provided in //prebuilt/... and don't need to get installed on your system.

Troubleshooting

The following error is likely caused by running an outdated version of Java.

device Dex: core  UNEXPECTED TOP-LEVEL ERROR:
java.lang.NoSuchMethodError: method java.util.Arrays.hashCode with
signature ([Ljava.lang.Object;)I was not found.
  at com.google.util.FixedSizeList.hashCode(FixedSizeList.java:66)
  at com.google.rop.code.Rop.hashCode(Rop.java:245)
  at java.util.HashMap.hash(libgcj.so.7)
[...]

dx is a Java program that uses facilities first made available in Java version 1.5. Check your version of Java by executing % java -version in the shell you use to build. You should see something like:

java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)

If you do have Java 1.5 or later and your receive this error, verify that you have properly updated your PATH variable.

Building the Android Kernel

This section describes how to build Android's default kernel. Once you are comfortable with a generic build, then you can begin to modify Android drivers for your own target device.

To build the kernel base, switch to the device directory (/home/joe/android/device) in order to establish variables and run:

% . build/envsetup.sh
% partner_setup generic

Then switch to the kernel directory /home/joe/android/kernel.

Checking Out a Branch

The default branch is always android. To check out a different branch, execute the following:

% git checkout --track -b android-mydevice origin/android-mydevice
  //Branch android-mydevice set up to track remote branch
% refs/remotes/origin/android-mydevice.
  //Switched to a new branch "android-mydevice"

To simplify code management, give your local branch the same name as the remote branch it is tracking (as illustrated in the snippet above). Switch between branches by executing % git checkout <branchname>.

Verifying Location

Find out which branches exist (both locally and remotely) and which one is active (marked with an asterisk) by executing the following:

% git branch -a
  android
* android-mydevice
  origin/HEAD
  origin/android
  origin/android-mydevice
  origin/android-mychipset

To only see local branches, omit the -a flag.

Building the Kernel

To build the kernel, execute:

% make -j4

Build Variants

When building for a particular product, it's often useful to have minor variations on what is ultimately the final release build. These are the currently-defined build variants:

eng This is the default flavor. A plain make is the same as make eng.
  • Installs modules tagged with: engdebuguser, and/or development.
  • Installs non-APK modules that have no tags specified.
  • Installs APKs according to the product definition files, in addition to tagged APKs.
  • ro.secure=0
  • ro.debuggable=1
  • ro.kernel.android.checkjni=1
  • adb is enabled by default.
user make user

This is the flavor intended to be the final release bits.

  • Installs modules tagged with user.
  • Installs non-APK modules that have no tags specified.
  • Installs APKs according to the product definition files; tags are ignored for APK modules.
  • ro.secure=1
  • ro.debuggable=0
  • adb is disabled by default.
userdebug make userdebug

The same as user, except:

  • Also installs modules tagged with debug.
  • ro.debuggable=1
  • adb is enabled by default.

If you build one flavor and then want to build another, you should run make installclean between the two makes to guarantee that you don't pick up files installed by the previous flavor. make clean will also suffice, but it takes a lot longer.



Configuring a New Product

Detailed Instructions

The steps below describe how to configure makefiles for new mobile devices and products running Android.

  1. Create a company directory in //vendor/.
      mkdir vendor/<company_name>
  2. Create a products directory beneath the company directory you created in step 1.
      mkdir vendor/<company_name>/products/
  3. Create a product-specific makefile, called vendor/<company_name>/products/<first_product_name>.mk, that includes at least the following code:
      $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
      #
      # Overrides
      PRODUCT_NAME := <first_product_name>
      PRODUCT_DEVICE := <board_name>
  4. Additional product-specific variables can be added to this Product Definition file.
  5. In the products directory, create an AndroidProducts.mk file that point to (and is responsible for finding) the individual product make files.
      #
      # This file should set PRODUCT_MAKEFILES to a list of product makefiles
      # to expose to the build system.  LOCAL_DIR will already be set to
      # the directory containing this file. 
      #
      # This file may not rely on the value of any variable other than
      # LOCAL_DIR; do not use any conditionals, and do not look up the
      # value of any variable that isn't set in this file or in a file that
      # it includes.
      #
      
      PRODUCT_MAKEFILES := \
        $(LOCAL_DIR)/first_product_name.mk \
  6. Create a board-specific directory beneath your company directory that matches the PRODUCT_DEVICE variable <board_name> referenced in the product-specific make file above. This will include a make file that gets accessed by any product using this board.
      mkdir vendor/<company_name>/<board_name>
  7. Create a BoardConfig.mk file in the directory created in the previous step (vendor/<company_name>/<board_name>). 
      # These definitions override the defaults in config/config.make for <board_name>
      #
      # TARGET_NO_BOOTLOADER := false
      # TARGET_HARDWARE_3D := false 
      #
      TARGET_USE_GENERIC_AUDIO := true
  8. If you wish to modify system properties, create a system.prop file in your <board_name> directory(vendor/<company_name>/<board_name>).
      # system.prop for 
      # This overrides settings in the products/generic/system.prop file
      #
      # rild.libpath=/system/lib/libreference-ril.so
      # rild.libargs=-d /dev/ttyS0
  9. Add a pointer to <second_product_name>.mk within products/AndroidProducts.mk.
      PRODUCT_MAKEFILES := \
        $(LOCAL_DIR)/first_product_name.mk \
        $(LOCAL_DIR)/second_product_name.mk
  10. An Android.mk file must be included in vendor/<company_name>/<board_name> with at least the following code:
      # make file for new hardware  from 
      #
      LOCAL_PATH := $(call my-dir)
      #
      # this is here to use the pre-built kernel
      ifeq ($(TARGET_PREBUILT_KERNEL),)
      TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
      endif
      #
      file := $(INSTALLED_KERNEL_TARGET)
      ALL_PREBUILT += $(file)
      $(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
    		$(transform-prebuilt-to-target)
      #
      # no boot loader, so we don't need any of that stuff..  
      #
      LOCAL_PATH := vendor/<company_name>/<board_name>
      #
      include $(CLEAR_VARS)
      #
      # include more board specific stuff here? Such as Audio parameters.      
      #
  11. To create a second product for the same board, create a second product-specific make file called vendor/company_name/products/<second_product_name>.mkthat includes:
      $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
      #
      # Overrides
      PRODUCT_NAME := <second_product_name>
      PRODUCT_DEVICE := <board_name>

By now, you should have two new products, called <first_product_name> and <second_product_name> associated with <company_name>. To verify that a product is properly configured (<first_product_name>, for example), execute the following:

  . build/envsetup.sh
  make PRODUCT-<first_product_name>-user

You should find new build binaries located in /out/target/product/<board_name>.

New Product File Tree

The file tree below illustrates what your own system should look like after completing the steps above.

  • <company_name>
    • <board_name>
      • Android.mk
      • product_config.mk
      • system.prop
    • products
      • AndroidProducts.mk
      • <first_product_name>.mk
      • <second_product_name>.mk

Product Definition Files

Product-specific variables are defined in product definition files. A product definition file can inherit from other product definition files, thus reducing the need to copy and simplifying maintenance.

Variables maintained in a product definition files include:

Parameter Description Example
PRODUCT_NAME End-user-visible name for the overall product. Appears in the "About the phone" info.  
PRODUCT_MODEL End-user-visible name for the end product  
PRODUCT_LOCALES A space-separated list of two-letter language code, two-letter country code pairs that describe several settings for the user, such as the UI language and time, date and currency formatting. The first locale listed in PRODUCT_LOCALES is is used if the locale has never been set before. en_GB de_DE es_ES fr_CA
PRODUCT_PACKAGES Lists the APKs to install. Calendar Contacts
PRODUCT_DEVICE Name of the industrial design dream
PRODUCT_MANUFACTURER Name of the manufacturer acme
PRODUCT_BRAND The brand (e.g., carrier) the software is customized for, if any  
PRODUCT_PROPERTY_OVERRIDES List of property assignments in the format "key=value"  
PRODUCT_COPY_FILES List of words like source_path:destination_path. The file at the source path should be copied to the destination path when building this product. The rules for the copy steps are defined in config/Makefile  
PRODUCT_OTA_PUBLIC_KEYS List of OTA public keys for the product  
PRODUCT_POLICY Indicate which policy this product should use  
PRODUCT_PACKAGE_OVERLAYS Indicate whether to use default resources or add any product specific overlays vendor/acme/overlay
PRODUCT_CONTRIBUTORS_FILE HTML file containing the contributors to the project.  
PRODUCT_TAGS list of space-separated words for a given product  

The snippet below illustrates a typical product definition file.

$(call inherit-product, build/target/product/generic.mk)

#Overrides
PRODUCT_NAME := MyDevice
PRODUCT_MANUFACTURER := acme
PRODUCT_BRAND := acme_us
PRODUCT_LOCALES := en_GB es_ES fr_FR
PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay



Build Cookbook

The Android Build Cookbook offers code snippets to help you quickly implement some common build tasks. For additional instruction, please see the other build documents in this section.

Building a simple APK

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # Build all java files in the java subdirectory
  LOCAL_SRC_FILES := $(call all-subdir-java-files)
   
  # Name of the APK to build
  LOCAL_PACKAGE_NAME := LocalPackage
   
  # Tell it to build an APK
  include $(BUILD_PACKAGE)

Building a APK that depends on a static .jar file

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # List of static libraries to include in the package
  LOCAL_STATIC_JAVA_LIBRARIES := static-library
   
  # Build all java files in the java subdirectory
  LOCAL_SRC_FILES := $(call all-subdir-java-files)
   
  # Name of the APK to build
  LOCAL_PACKAGE_NAME := LocalPackage
   
  # Tell it to build an APK
  include $(BUILD_PACKAGE)

Building a APK that should be signed with the platform key

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # Build all java files in the java subdirectory
  LOCAL_SRC_FILES := $(call all-subdir-java-files)
   
  # Name of the APK to build
  LOCAL_PACKAGE_NAME := LocalPackage
   
  LOCAL_CERTIFICATE := platform
   
  # Tell it to build an APK
  include $(BUILD_PACKAGE)

Building a APK that should be signed with a specific vendor key

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # Build all java files in the java subdirectory
  LOCAL_SRC_FILES := $(call all-subdir-java-files)
   
  # Name of the APK to build
  LOCAL_PACKAGE_NAME := LocalPackage
   
  LOCAL_CERTIFICATE := vendor/example/certs/app
   
  # Tell it to build an APK
  include $(BUILD_PACKAGE)

Adding a prebuilt APK

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # Module name should match apk name to be installed.
  LOCAL_MODULE := LocalModuleName
  LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
  LOCAL_MODULE_CLASS := APPS
  LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
   
  include $(BUILD_PREBUILT)

Adding a Static Java Library

  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
   
  # Build all java files in the java subdirectory
  LOCAL_SRC_FILES := $(call all-subdir-java-files)
   
  # Any libraries that this library depends on
  LOCAL_JAVA_LIBRARIES := android.test.runner
   
  # The name of the jar file to create
  LOCAL_MODULE := sample
   
  # Build a static jar file.
  include $(BUILD_STATIC_JAVA_LIBRARY)

Android.mk Variables

These are the variables that you'll commonly see in Android.mk files, listed alphabetically. First, a note on the variable naming:

  • LOCAL_ - These variables are set per-module. They are cleared by the include $(CLEAR_VARS) line, so you can rely on them being empty after including that file. Most of the variables you'll use in most modules are LOCAL_ variables.
  • PRIVATE_ - These variables are make-target-specific variables. That means they're only usable within the commands for that module. It also means that they're unlikely to change behind your back from modules that are included after yours. This link to the make documentation describes more about target-specific variables.
  • HOST_ and TARGET_ - These contain the directories and definitions that are specific to either the host or the target builds. Do not set variables that start with HOST_ or TARGET_ in your makefiles.
  • BUILD_ and CLEAR_VARS - These contain the names of well-defined template makefiles to include. Some examples are CLEAR_VARS and BUILD_HOST_PACKAGE.
  • Any other name is fair-game for you to use in your Android.mk. However, remember that this is a non-recursive build system, so it is possible that your variable will be changed by another Android.mk included later, and be different when the commands for your rule / module are executed.
Parameter Description
LOCAL_AAPT_FLAGS  
LOCAL_ACP_UNAVAILABLE  
LOCAL_ADDITIONAL_JAVA_DIR  
LOCAL_AIDL_INCLUDES  
LOCAL_ALLOW_UNDEFINED_SYMBOLS  
LOCAL_ARM_MODE  
LOCAL_ASFLAGS  
LOCAL_ASSET_DIR  
LOCAL_ASSET_FILES In Android.mk files that include $(BUILD_PACKAGE) set this to the set of files you want built into your app. Usually:

LOCAL_ASSET_FILES += $(call find-subdir-assets)

LOCAL_BUILT_MODULE_STEM  
LOCAL_C_INCLUDES

Additional directories to instruct the C/C++ compilers to look for header files in. These paths are rooted at the top of the tree. Use LOCAL_PATH if you have subdirectories of your own that you want in the include paths. For example:

LOCAL_C_INCLUDES += extlibs/zlib-1.2.3
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src

You should not add subdirectories of include to LOCAL_C_INCLUDES, instead you should reference those files in the #include statement with their subdirectories. For example:

#include <utils/KeyedVector.h>
not #include <KeyedVector.h>

LOCAL_CC If you want to use a different C compiler for this module, set LOCAL_CC to the path to the compiler. If LOCAL_CC is blank, the appropriate default compiler is used.
LOCAL_CERTIFICATE  
LOCAL_CFLAGS If you have additional flags to pass into the C or C++ compiler, add them here. For example:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1

LOCAL_CLASSPATH  
LOCAL_COMPRESS_MODULE_SYMBOLS  
LOCAL_COPY_HEADERS

The set of files to copy to the install include tree. You must also supply LOCAL_COPY_HEADERS_TO.

This is going away because copying headers messes up the error messages, and may lead to people editing those headers instead of the correct ones. It also makes it easier to do bad layering in the system, which we want to avoid. We also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any headers.

LOCAL_COPY_HEADERS_TO

The directory within "include" to copy the headers listed in LOCAL_COPY_HEADERS to.

This is going away because copying headers messes up the error messages, and may lead to people editing those headers instead of the correct ones. It also makes it easier to do bad layering in the system, which we want to avoid. We also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any headers.

LOCAL_CPP_EXTENSION If your C++ files end in something other than ".cpp", you can specify the custom extension here. For example:

LOCAL_CPP_EXTENSION := .cc

Note that all C++ files for a given module must have the same extension; it is not currently possible to mix different extensions.
LOCAL_CPPFLAGS If you have additional flags to pass into only the C++ compiler, add them here. For example:

LOCAL_CPPFLAGS += -ffriend-injection

LOCAL_CPPFLAGS is guaranteed to be after LOCAL_CFLAGS on the compile line, so you can use it to override flags listed in LOCAL_CFLAGS
LOCAL_CXX If you want to use a different C++ compiler for this module, set LOCAL_CXX to the path to the compiler. If LOCAL_CXX is blank, the appropriate default compiler is used.
LOCAL_DX_FLAGS  
LOCAL_EXPORT_PACKAGE_RESOURCES  
LOCAL_FORCE_STATIC_EXECUTABLE

If your executable should be linked statically, set LOCAL_FORCE_STATIC_EXECUTABLE:=true. There is a very short list of libraries that we have in static form (currently only libc). This is really only used for executables in /sbin on the root filesystem.

LOCAL_GENERATED_SOURCES

Files that you add to LOCAL_GENERATED_SOURCES will be automatically generated and then linked in when your module is built. See the Custom Tools template makefile for an example.

LOCAL_INSTRUMENTATION_FOR  
LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME  
LOCAL_INTERMEDIATE_SOURCES  
LOCAL_INTERMEDIATE_TARGETS  
LOCAL_IS_HOST_MODULE  
LOCAL_JAR_MANIFEST  
LOCAL_JARJAR_RULES  
LOCAL_JAVA_LIBRARIES

When linking Java apps and libraries, LOCAL_JAVA_LIBRARIES specifies which sets of java classes to include. Currently there are two of these: core and framework. In most cases, it will look like this:

LOCAL_JAVA_LIBRARIES := core framework

Note that setting LOCAL_JAVA_LIBRARIES is not necessary (and is not allowed) when building an APK with "include $(BUILD_PACKAGE)". The appropriate libraries will be included automatically.

LOCAL_JAVA_RESOURCE_DIRS  
LOCAL_JAVA_RESOURCE_FILES  
LOCAL_JNI_SHARED_LIBRARIES  
LOCAL_LDFLAGS

You can pass additional flags to the linker by setting LOCAL_LDFLAGS. Keep in mind that the order of parameters is very important to ld, so test whatever you do on all platforms.

LOCAL_LDLIBS

LOCAL_LDLIBS allows you to specify additional libraries that are not part of the build for your executable or library. Specify the libraries you want in -lxxx format; they're passed directly to the link line. However, keep in mind that there will be no dependency generated for these libraries. It's most useful in simulator builds where you want to use a library preinstalled on the host. The linker (ld) is a particularly fussy beast, so it's sometimes necessary to pass other flags here if you're doing something sneaky. Some examples:

LOCAL_LDLIBS += -lcurses -lpthread
LOCAL_LDLIBS += -Wl,-z,origin

LOCAL_MODULE LOCAL_MODULE is the name of what's supposed to be generated from your Android.mk. For exmample, for libkjs, the LOCAL_MODULE is "libkjs" (the build system adds the appropriate suffix -- .so .dylib .dll). For app modules, use LOCAL_PACKAGE_NAME instead of LOCAL_MODULE.
LOCAL_MODULE_PATH Instructs the build system to put the module somewhere other than what's normal for its type. If you override this, make sure you also set LOCAL_UNSTRIPPED_PATH if it's an executable or a shared library so the unstripped binary has somewhere to go. An error will occur if you forget to.

See Putting modules elsewhere for more.

LOCAL_MODULE_STEM  
LOCAL_MODULE_TAGS

Set LOCAL_MODULE_TAGS to any number of whitespace-separated tags.

This variable controls what build flavors the package gets included in. For example:

  • user: include this in user/userdebug builds
  • eng: include this in eng builds
  • tests: the target is a testing target and makes it available for tests
  • optional: don't include this
LOCAL_NO_DEFAULT_COMPILER_FLAGS  
LOCAL_NO_EMMA_COMPILE  
LOCAL_NO_EMMA_INSTRUMENT  
LOCAL_NO_STANDARD_LIBRARIES  
LOCAL_OVERRIDES_PACKAGES  
LOCAL_PACKAGE_NAME LOCAL_PACKAGE_NAME is the name of an app. For example, Dialer, Contacts, etc.
LOCAL_POST_PROCESS_COMMAND

For host executables, you can specify a command to run on the module after it's been linked. You might have to go through some contortions to get variables right because of early or late variable evaluation:

module := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)
LOCAL_POST_PROCESS_COMMAND := /Developer/Tools/Rez -d __DARWIN__ -t APPL\
       -d __WXMAC__ -o $(module) Carbon.r

LOCAL_PREBUILT_EXECUTABLES When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to executables that you want copied. They're located automatically into the right bin directory.
LOCAL_PREBUILT_JAVA_LIBRARIES  
LOCAL_PREBUILT_LIBS When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to libraries that you want copied. They're located automatically into the right lib directory.
LOCAL_PREBUILT_OBJ_FILES  
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES  
LOCAL_PRELINK_MODULE  
LOCAL_REQUIRED_MODULES

Set LOCAL_REQUIRED_MODULES to any number of whitespace-separated module names, like "libblah" or "Email". If this module is installed, all of the modules that it requires will be installed as well. This can be used to, e.g., ensure that necessary shared libraries or providers are installed when a given app is installed.

LOCAL_RESOURCE_DIR  
LOCAL_SDK_VERSION  
LOCAL_SHARED_LIBRARIES These are the libraries you directly link against. You don't need to pass transitively included libraries. Specify the name without the suffix:

LOCAL_SHARED_LIBRARIES := \
    libutils \
    libui \
    libaudio \
    libexpat \
    libsgl

LOCAL_SRC_FILES The build system looks at LOCAL_SRC_FILES to know what source files to compile -- .cpp .c .y .l .java. For lex and yacc files, it knows how to correctly do the intermediate .h and .c/.cpp files automatically. If the files are in a subdirectory of the one containing the Android.mk, prefix them with the directory name:

LOCAL_SRC_FILES := \
    file1.cpp \
    dir/file2.cpp

LOCAL_STATIC_JAVA_LIBRARIES  
LOCAL_STATIC_LIBRARIES These are the static libraries that you want to include in your module. Mostly, we use shared libraries, but there are a couple of places, like executables in sbin and host executables where we use static libraries instead.

LOCAL_STATIC_LIBRARIES := \
    libutils \
    libtinyxml

LOCAL_UNINSTALLABLE_MODULE  
LOCAL_UNSTRIPPED_PATH Instructs the build system to put the unstripped version of the module somewhere other than what's normal for its type. Usually, you override this because you overrode LOCAL_MODULE_PATH for an executable or a shared library. If you overrode LOCAL_MODULE_PATH, but not LOCAL_UNSTRIPPED_PATH, an error will occur.

See Putting modules elsewhere for more.

LOCAL_WHOLE_STATIC_LIBRARIES These are the static libraries that you want to include in your module without allowing the linker to remove dead code from them. This is mostly useful if you want to add a static library to a shared library and have the static library's content exposed from the shared library.

LOCAL_WHOLE_STATIC_LIBRARIES := \
    libsqlite3_android

LOCAL_YACCFLAGS Any flags to pass to invocations of yacc for your module. A known limitation here is that the flags will be the same for all invocations of YACC for your module. This can be fixed. If you ever need it to be, just ask.

LOCAL_YACCFLAGS := -p kjsyy

OVERRIDE_BUILT_MODULE_PATH  
↑ Go to top

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/LongZh_CN/article/details/36907785

智能推荐

探秘高效Linux C/C++项目架构:让进程、线程和通信方式助力你的代码飞跃_linux c++线程间通信-程序员宅基地

文章浏览阅读1.5k次。探秘高效项目架构:让进程、线程和通信方式助力你的代码飞跃_linux c++线程间通信

PROFINET主站转MODBUS-TCP协议网关_profinet转modbus-程序员宅基地

文章浏览阅读106次。本产品是 ModbusTCP 和 Profinet(M)网关 (以下简称网关) ,使用数据映射 方式工作。本产品在 ModbusTCP 侧作为 ModbusTCP 从站,接 PLC 、上位机、wincc 屏等;在 Profinet 侧做为 Profinet 主站控制器,接 Profinet 设备,如伺服驱动器。_profinet转modbus

电子模块|压力传感器模块HX711---C51&&STM32驱动_单片机hx711驱动-程序员宅基地

文章浏览阅读2.2k次。HX711是一款专为高精度称重传感器而设计的24位A/D转换器芯片。与同类型其它芯片相比,该芯片集成了包括稳压电源、片内时钟振荡器等其它同类型芯片所需要的外围电路,具有集成度高、响应速度快、抗干扰性强等优点。降低了电子秤的整机成本,提高了整机的性能和可靠性。该芯片与后端MCU芯片的接口和编程非常简单,所有控制信号由管脚驱动,无需对芯片内部的寄存器编程。输入选择开关可任意选取通道A或通道B,与其内部的低噪声可编程放大器相连。_单片机hx711驱动

微信小程序 java springboot 57.高校毕业生就业信息的设计与实现(完整源码+数据库文件+万字文档+保姆级视频部署教程+配套环境)-程序员宅基地

文章浏览阅读263次,点赞6次,收藏5次。针对高校教师成果信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,采用高校毕业生就业信息可以有效管理,使信息管理能够更加科学和规范。高校毕业生就业信息使用 Java 语言进行编码,使用 Mysql 创建数据表保存本系统产生的数据。系统可以提供信息显示和相应服务,其管理高校毕业生就业信息信息,查看高校毕业生就业信息信息,管理高校毕业生就业信息。总之,高校毕业生就业信息集中管理信息,有着保密性强,效率高,存储空间大,成本低等诸多优点。数据库工具:Navicat;开发语言:Java;

ERROR: Failed to resolve: com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46-程序员宅基地

文章浏览阅读1.6w次,点赞3次,收藏3次。今天弄一个demo 导入brvah 出现的错误,又去看了下教程 是自己忘记添加jitpack仓库了_error: failed to resolve: com.github.cymchad:baserecyclerviewadapterhelper:2

对人脸检测和人脸识别的理解_人脸检测和人脸属性识别的意义-程序员宅基地

文章浏览阅读1.5k次。人脸检测是指对输入图像中判断是否存在人脸区域,并进一步确定人脸的位置、大小、姿态等信息。 这些算法大致分为三种类别:基于肤色的检测方法、基于形状的检测方法、基于统计理论的检测方法。 人脸识别技术是基于人的脸部特征,一个完整的人脸识别过程一般包括人脸检测和人脸识别两大部分。人脸识别就是将待识别的人脸与已知的人脸进行比较,得出相似程度的相关信息。 人脸自动识别系统包括三个主要的环节:首先是图像预处_人脸检测和人脸属性识别的意义

随便推点

深圳大学本科毕业论文答辩PPT模板_深圳大学答辩ppt模板-程序员宅基地

文章浏览阅读701次。模板介绍精美PPT模板设计,深圳大学本科毕业论文答辩PPT模板。一套高校PPT幻灯片模板,内含灰色,红色多种配色,精美风格设计,动态播放效果,精美实用。一份设计精美的PPT模板,可以让你在汇报演讲时脱颖而出。希望下面这份精美的PPT模板能给你带来帮助,温馨提示:本资源使用PPT或PPTX等格式,请安装并使用Office或WPS软件打开。模板信息模板编号:P95164用途:高校PPT。模板格式:pptx格式(可随意下载编辑)页数:27页大小:10MB比例:16:9编辑软件:wp_深圳大学答辩ppt模板

为类创建自定义调试信息,让你的调试更加方便快捷-程序员宅基地

文章浏览阅读206次。我们在应用程序中使用类一组类,你想在调试器中快速查看类中的值。默认情况下调试器不会展示自定义类的信息。此时我们可以向类添加一个DebuggerDisplay的特性。此时调试器就会你想要显示的信息。如下 [DebuggerDisplay("User Full Name={Id} {Name} {Age}")] public class User {..._怎么在sys的class目录生成调试信息

小米路由器r3gv2/r4a Lean的OpenWrt固件_openwrt-ramips-mt7621-xiaomi_r4a-squashfs-sysupgra-程序员宅基地

文章浏览阅读2.3w次,点赞4次,收藏16次。小米路由器r3gv2这是一款运营商定制的小米千兆路由器,是r3g(128M+256M+USB)的阉割版,闪存16M,内存128M,处理器是MediaTek MT7621,这个配置勉强可以玩一玩,闲鱼上也有很多,性价比比较高。进入路由器终端自己刷固件的话,首先就是要打开路由器的ssh或者telnet,小米早年的路由器官方都有开启ssh的教程,而这款就需要自己想办法了。Root shell exploit for several Xiaomi routers: 4A Gigabit, 4A 100M,_openwrt-ramips-mt7621-xiaomi_r4a-squashfs-sysupgrade

文本和二进制文件-程序员宅基地

文章浏览阅读290次,点赞5次,收藏7次。*根据数据的组织形式,数据文件被称为文本文件或者二进制文件。数据在内存中以二进制的形式存储,如果不加转换的输出到外存,就是二进制文件。如果要求在外存上以ASCII码的形式存储,则需要在存储前转换。以ASCII字符的形式存储的文件就是文本文件。字符一律以ASCII形式存储,数值型数据既可以用ASCII形式存储,也可以使用二进制形式存储。如有整数10000,如果以ASCII码的形式输出到磁盘,则磁盘中占用5个字节(每个字符一个字节),而。

GObject-程序员宅基地

文章浏览阅读387次。#define JC_TYPE_BOY (jc_boy_get_type ())//实例类型转换#define JC_BOY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JC_TYPE_BOY, JcBoy))//实例类型判定#define JC_IS_BOY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj)_gobject

Swift5.0 常用三方库集锦_swift日志三方库-程序员宅基地

文章浏览阅读1.3k次。#必备 pod 'Alamofire' #网络请求 pod 'SwiftyJSON' #json解析 pod 'Kingfisher' #图片缓存 pod 'SwiftyUserDefaults' #UserDefaults pod 'IQKeyboardManagerSwift' pod 'SnapKit' #auto L..._swift日志三方库