Reprint: http://hubingforever.blog.163.com/blog/static/1710405792011656434982/
here are just a few examples of using ANDROID.MK to compile the APK program. If you want to learn more about ANDROID.MK, please refer to theBrief introduction of android.mk
First,Compile a
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 a
apk that relies on static. jar FilesLocal_path: = $ (call My-dir)include $ (clear_vars) # List of static libraries to include in the packagelocal_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 buildlocal_package_name: = LocalPackage # Tell it to build an APK include $ (build_package)
Note:local_static_java_librariesThe following should be the jar file name of the Java library required by your APK program.
Third,Compile a
apk with platform key signature requiredLocal_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 buildlocal_package_name: = LocalPackagelocal_certificate:= Platform # Tell it to build an APK include $ (build_package)Note:Local_certificate should be the name of the signature file after
Four,Compile a
apk with special vendor key signature requiredLocal_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 buildlocal_package_name: = LocalPackagelocal_certificate: = Vendor/example/certs/app # Tell it to build an APK include $ (build_package)
Five,Load a
normal third-party apkLocal_path: = $ (call My-dir)include $ (clear_vars) # Module name should match apk name to be installed. local_module: = Localmodulenamelocal_src_files: = $ (local_module). APKLocal_module_class: = APPSLocal_module_suffix: = $ (Common_android_package_suffix)local_certificate: = Platforminclude $ (build_prebuilt)
Six,Loading
third-party apk that requires. So (Dynamic library)Local_path: = $ (My-dir)include $ (clear_vars)local_module: = baiduinput_android_v1.1_1000elocal_src_files: = $ (local_module). APKLocal_module_class: = APPSLocal_module_suffix: = $ (Common_android_package_suffix)local_certificate: = Platforminclude $ (build_prebuilt) ######################################################################## Copy the library to/system/lib ##########################################################################################include $ (clear_vars)local_module: = libinputcore.soLocal_module_class: = Shared_librariesLocal_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)Note:local_java_libraries represents the jar file name of the generated JAVA library.
ANDROID.MK Compiling apk example