Silence Ferret,
Date: June 28, 2015
In the development of regular packaging some common code, build jar, easy to use in other projects, improve development efficiency. Android how to use Na.
-
First introduce the JAR package generation
New Android project, e.g., tick mark this project as a library, then all the way to the finish
Without checking it doesn't matter, Android works can be converted to a library. Project Right-click Property->android Check is Library
After writing the code, there is a generated jar in the bin directory.
Well, the build jar ends here.
Note: There is only code in the generated jar, no resources. You can open the jar package with the compression software to view the confirmation
2 Using the Jar
Start with a new test project and import the new jar into the Lib folder so that it can be packaged in a package.
Then the normal Java project is imported into the jar package, and the build path->libraries->add jars import just packaged.
Finally check the jar in order and export so that it will be packaged into the APK.
Note: Because Androidmanifest.xml does not exist in the exported package, all declarations that you make in the jar are re-declared
Android packaging jar and using third-party libraries