Method 1: In eclipse,
Right-click the project,
Build path,
Java build path, select Libraries
Click "add library" in the button on the right"
Select "User library" and click "Next"
Click "User librarys ".
On the displayed page, click "new ...".
In the pop-up interface, enter a name and click "OK"
Click "add jars" to select a third-party jar package and click "OK.
The subsequent steps are very important if you do not perform subsequent operations. There will be no errors when compilation is passed in eclipse, but errors such as Java. Lang. noclassdeffounderror may occur when running on a simulator or a real machine:
1. Create a libs folder under the root directory of the android project;
2. Copy the required third-party jar package to this directory;
3. Right-click the libs directory and choose bulid path-> use as source folder.
Method 2: In the android source code environment,
1. Put the classess. jar file in out/target/common/obj/java_libraries/powersave_intermediates in your project directory. The jar package in the out/target/product/Ventana/system/framework directory cannot be verified by using the following methods, because it has been converted into a DEX file, it is not acceptable to reference its package in the project;
2. Modify the Android. mk file as follows:
Local_path: = $ (call my-DIR)
Include $ (clear_vars)
Local_module_tags: = optional
Local_src_files: = $ (call all-Java-files-under, Src)
Local_static_java_libraries: = libpowerjar libpowersave
Local_package_name: = testpowerjar
Local_certificate: = Platform
Include $ (build_package)
######################################## ######
Include $ (clear_vars)
Local_prebuilt_static_java_libraries: = libpowerjar: classes. Jar libpowersave: testlily. Jar
Include $ (build_multi_prebuilt)
# Use the folloing include to make our test APK.
Include $ (call all-makefiles-under, $ (local_path ))
Explanation: local_static_java_libraries: = libpowerjar and local_prebuilt_static_java_libraries: =
Libpowerjar: classes. jar actually libarity is a name that can be obtained at will. The values of the two attributes should be the same, but you must write your jar package name in the colon, your jar package must be placed in the root directory of the project. Here is an example of using two jar packages.
3. Compile the package in the source code Directory: # Mmm package/APP/testpowerjar. If an error occurs and the package cannot be found, # Touch
Classes. jar.
Generate a jar package:
Method 1: In eclipse,
1. Create a Java or android project;
2. Add Android. jar to Java build path> libraries.
3. In package explorer, right-click the project and choose export Java-> JAR file.
Method 2: In the android source code Environment
1. Modify the Android. mk file,
Local_path: = $ (call my-DIR)
# The Library
#===================================================== ==================================
Include $ (clear_vars)
Local_module_tags: = optional
Local_src_files: = powersave. Java
Local_module: = powersave
Include $ (build_java_library)
# Additionally, build unit tests in a separate. APK
Include $ (call all-makefiles-under, $ (local_path ))
2. Compile # Mmm powersave (your own module)
Build_java_library indicates that the jar package is generated. The package is stored in out/target/product/Ventana/system/framework and out/target/common/obj/java_libraries/powersave_intermediates (your own module),
Reference: http://www.eoeandroid.com/thread-34527-1-1.html
Right-click the project,
Build path,
Java build path, select Libraries
Click "add library" in the button on the right"
Select "User library" and click "Next"
Click "User librarys ".
On the displayed page, click "new ...".
In the pop-up interface, enter a name and click "OK"
Click "add jars" to select a third-party jar package and click "OK.
The subsequent steps are very important if you do not perform subsequent operations. There will be no errors when compilation is passed in eclipse, but errors such as Java. Lang. noclassdeffounderror may occur when running on a simulator or a real machine:
1. Create a libs folder under the root directory of the android project;
2. Copy the required third-party jar package to this directory;
3. Right-click the libs directory and choose bulid path-> use as source folder.
Method 2: In the android source code environment,
1. Put the classess. jar file in out/target/common/obj/java_libraries/powersave_intermediates in your project directory. The jar package in the out/target/product/Ventana/system/framework directory cannot be verified by using the following methods, because it has been converted into a DEX file, it is not acceptable to reference its package in the project;
2. Modify the Android. mk file as follows:
Local_path: = $ (call my-DIR)
Include $ (clear_vars)
Local_module_tags: = optional
Local_src_files: = $ (call all-Java-files-under, Src)
Local_static_java_libraries: = libpowerjar libpowersave
Local_package_name: = testpowerjar
Local_certificate: = Platform
Include $ (build_package)
######################################## ######
Include $ (clear_vars)
Local_prebuilt_static_java_libraries: = libpowerjar: classes. Jar libpowersave: testlily. Jar
Include $ (build_multi_prebuilt)
# Use the folloing include to make our test APK.
Include $ (call all-makefiles-under, $ (local_path ))
Explanation: local_static_java_libraries: = libpowerjar and local_prebuilt_static_java_libraries: =
Libpowerjar: classes. jar actually libarity is a name that can be obtained at will. The values of the two attributes should be the same, but you must write your jar package name in the colon, your jar package must be placed in the root directory of the project. Here is an example of using two jar packages.
3. Compile the package in the source code Directory: # Mmm package/APP/testpowerjar. If an error occurs and the package cannot be found, # Touch
Classes. jar.
Generate a jar package:
Method 1: In eclipse,
1. Create a Java or android project;
2. Add Android. jar to Java build path> libraries.
3. In package explorer, right-click the project and choose export Java-> JAR file.
Method 2: In the android source code Environment
1. Modify the Android. mk file,
Local_path: = $ (call my-DIR)
# The Library
#===================================================== ==================================
Include $ (clear_vars)
Local_module_tags: = optional
Local_src_files: = powersave. Java
Local_module: = powersave
Include $ (build_java_library)
# Additionally, build unit tests in a separate. APK
Include $ (call all-makefiles-under, $ (local_path ))
2. Compile # Mmm powersave (your own module)
Build_java_library indicates that the jar package is generated. The package is stored in out/target/product/Ventana/system/framework and out/target/common/obj/java_libraries/powersave_intermediates (your own module),
Reference: http://www.eoeandroid.com/thread-34527-1-1.html