How to introduce third-party jar packages in Android

Source: Internet
Author: User

Third-party external jar library files can be used on the Android platform. In the eclipse development environment, the third-party. jar file can be used in only three steps:
1. on the package explorer panel, right-click and choose Properties From the shortcut menu)
2. Select Java build path (Java build path) and then select the libraries tab.
3. Press the Add external jars button and select the JAR file.
If you want to include third-party jars to your package, create a new directory in your project and select Add library... instead, this site prompts that you do not need to put the external jars file into the project folder for normal use.

I checked it online. Some people said that the above practice may fail. We recommend that you follow the steps below:

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" to complete the operation.
In this case, the jar package will be packaged into the APK together, and the problem will be solved!

ThenCodeEncapsulated into a jar library for otherProgramWhat about reuse? The specific export steps are as follows: (transferred from: android123.com.cn)

First, create an android project, make sure that it can be compiled, and remove the androidmanifest. xml file and related program resource images, such as res/drawable/icon.png. In eclipse, find package explorer and select export ,:

In the export dialog box, select Java and JAR file, as shown in:

In JAR File Specification, select the resources that we need everywhere. In JAR file: path, select the storage location of the exported files, select compress the contents of the JAR file to compress the size of the generated file. Finally, click Next or finish to complete the export. In this way, you can import the library in future projects, and the code reuse effect is similar to the DLL file developed by Windows 32.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.