Android.mk compiling the. apk. Jar. A third-party. apk. Jar. A method

Source: Internet
Author: User

One, compile 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)

Second, compile an apk that relies on the 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)
Note: Local_static_java_libraries should be followed by the jar file name of the JAVA library required by your APK program.

Third, compile an apk that requires platform key signature

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)
Note: Local_certificate should be followed by the file name of the signature file

Iv. compiling an apk that requires a special vendor key signature

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)

V. Load an ordinary third-party 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)
Local_certificate: = Platform
Include $ (build_prebuilt)

Vi. loading required. So (Dynamic library) third-party apk

Local_path: = $ (My-dir)
Include $ (clear_vars)
Local_module: = baiduinput_android_v1.1_1000e
Local_src_files: = $ (local_module). apk
Local_module_class: = APPS
Local_module_suffix: = $ (Common_android_package_suffix)
Local_certificate: = Platform
Include $ (build_prebuilt)

#################################################################
####### Copy the library to/system/lib #########################
#################################################################
Include $ (clear_vars)
Local_module: = libinputcore.so
Local_module_class: = shared_libraries
Local_module_path: = $ (target_out_shared_libraries)
Local_src_files: = lib/$ (Local_module)
Override_build_module_path: = $ (target_out_intermediate_libraries)
Include $ (build_prebuilt)

Vii. compiling 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 the 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)

Source: http://www.cnblogs.com/hopetribe/archive/2012/04/23/2467060.html

Include $ (clear_vars)


Local_prebuilt_static_java_libraries: = Ta:libs/ta4aidl.jar
Include $ (build_multi_prebuilt)


The following code can be added to any file:
To join a shared library:
Local_module: = Libffmpeg #库的名字
Local_module_tags: = optional #系统内有效. You can try not to add this line to see the error message.
Local_prebuilt_libs: = libffmpeg.so #库的路径.


Include $ (build_multi_prebuilt) #这行比較重要是实际做事的地方. This article: Add a third-party library to the Android source code

To add a static library:
Include $ (clear_vars)
Local_module: = Libavcodec
Local_prebuilt_libs: = LIBAVCODEC.A
Local_module_tags: = Optional
Include $ (build_multi_prebuilt)

Static libraries and dynamic libraries are appropriate, static libraries are used when linking, and dynamic libraries are used at execution time. Usage:

Add something similar to the following in the Android.mk file for the module that you want to use for the corresponding library:

Static libraries (used when linking.) It will be copied to the Out/target/product/generic/obj/static_libraries/libavcodec_intermediates/folder):

Local_whole_static_libraries + = \
Libavcodec #这个是模块名 (Local_module)
Dynamic library (for execution.) It will be copied to the/system/lib/folder. ):
Local_shared_libraries + = \
Libffmpeg

Include $ (call all-makefiles-under,$ (Local_path)) #这句上调用子文件夹下的非常有Android. mk

Source: http://hi.baidu.com/2400xiaobing/item/ffa78cd51f76d81521e25085

Local_static_java_libraries: = Ta

Include $ (clear_vars)


Local_prebuilt_static_java_libraries: = Ta:libs/ta4aidl.jar
Include $ (build_multi_prebuilt)

Android.mk compiling the. apk. Jar. A third-party. apk. Jar. A method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.