Original URL: http://blog.csdn.net/jscese/article/details/36627195
Android APK in the development of eclipse, sometimes need to import some classes in other packages, the normal way is to add the jar package in the Java Build path library!
Reprint Annotated Source: http://blog.csdn.net/jscese/article/details/36627195
A. apk to share class between
One of the androoid projects in eclipse to use the class of another project, you can add it to the project's project.properties file:
[HTML]View Plaincopyprint?
- android.library.reference.1= Project Path
REFERENCE.1 indicates the number of the library, and there are a number of words added in turn,
Project path represents the path to the target project, either an absolute path or a relative path
The target project needs to be configured as follows:
Properties-->android-->is Library Point selection!
This will be compiled to find the reference class, but also in the compiled project Properties-->android to see the reference library name!
Two. APK Export jar Package
Many times you cannot directly originate the code project, this time you can choose the export from eclipse
Select the JAR file next:
Choose the path to export, some of the deployment and compilation files in the upper right corner can be imported or not, finish can
After the completion of the jar package:
You can see that the SRC resource files and res resources are also packaged into the jar package,
This jar can be used by other projects by adding the add external jar in the Java Build path option!
There is also a way to package the project into a jar package:
As mentioned above select is Library this option, then compile the entire project, will be in the bin directory to generate the corresponding project. jar
"Go" android--eclipse Share Library and export jar package