Typically, a typical makefile (ANDROID.MK) that compiles a jar package under Android Source code is as follows:
Add the following to the file:
|
Local_path:= $ (call My-dir)
#make jar
Include $ (clear_vars)
Local_src_files: = $ (call all-subdir-java-files)
Local_module: = Mytestjar
Include $ (build_java_library)
#include $ (build_static_java_library) |
So, what is the difference between build_java_library and build_static_java_library?
Simply put, the jar package is actually a zip-format package, then:
1. Build_java_library compiled jar package, which is the DEX format file, if the user wants to use this jar to put into eclipse to do Android app development, Eclipse is not aware of this format of files, Usually error: Conversion to Dalvik format failed with error 1;
2. While the build_static_java_library compiled jar package, each Java file corresponding to the class file exists separately, as the name implies, each Java file used in the variables are statically compiled into the class inside, The jar package in this format can be imported and used normally in eclipse, but there may be some compatibility problems, this is discussed separately.
Android source code compilation jar Package Build_java_library and build_static_java_library difference