[Javascript]
1. android general application developers
What we saw most on the internet is Add jars, Add External Jars or Add Library in Java Build Path. In fact, these are just to ensure that compilation is normal.
Only after you have tried it can you find out that the corresponding third-party jar package cannot be found during running.
For example, if you want to import jar packages of org.apache.commons.net (implementation of various protocol stacks) to your program
First, you must check your ADT version.
Before ADT17, you need to create the lib directory under the root directory, put the jar package under lib, and right-click add to build path
After ADT17, it will be more intelligent. You only need to create the libs directory in the root directory and put it into the jar package. It will automatically generate Android Dependencies
Do not forget to right-click the project and choose android tools> Fix project properties.
Success or failure depends on whether Android Dependencies are generated in Libraries of Java Build Path (the jar package you depend on can be seen in it)
2. android system application developers
You need to modify the android. mk file of your app.
[Javascript]
LOCAL_PATH: = $ (call my-dir)
Include $ (CLEAR_VARS)
LOCAL_MODULE_TAGS: = optional
<SPAN style = "COLOR: # ff0000"> LOCAL_STATIC_JAVA_LIBRARIES: = apache-net </SPAN>
LOCAL_SRC_FILES: = $ (call all-subdir-java-files)
LOCAL_PACKAGE_NAME: = xxx
LOCAL_CERTIFICATE: = platform
Include $ (BUILD_PACKAGE)
<SPAN style = "COLOR: # ff0000 "> #################################### ##############
Include $ (CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES: = apache-net: lib/commons-net-3.2.jar
Include $ (BUILD_MULTI_PREBUILT) </SPAN>
LOCAL_PATH: = $ (call my-dir)
Include $ (CLEAR_VARS)
LOCAL_MODULE_TAGS: = optional
LOCAL_STATIC_JAVA_LIBRARIES: = apache-net
LOCAL_SRC_FILES: = $ (call all-subdir-java-files)
LOCAL_PACKAGE_NAME: = xxx
LOCAL_CERTIFICATE: = platform
Include $ (BUILD_PACKAGE)
######################################## ##########
Include $ (CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES: = apache-net: lib/commons-net-3.2.jar
Include $ (BUILD_MULTI_PREBUILT)
The red font indicates the part you want to add. LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES only compiles the third-party jar package under the lib directory into the static jar java library and rename it to apache-net.
This is why LOCAL_STATIC_JAVA_LIBRARIES is equal to apache-net.
Run the command after modifying mm.