Android package third-party jar packages

Source: Internet
Author: User

A third-party jar package is used for Android project development. Generally, follow the eclipse import jar package method (select a project, right-click build path, build path-> Add libraries-> User library-> next-> User libraries-> New-> Add jars, select a third-party jar package ), you can import the jar package to the project.

According to this packaging method, the eclipse compiler can also identify the jar package imported by ECLIPSE, that is, the project will not report errors due to the lack of jar packages, however, when running the android program, no package is found and an error is reported. The APK file is small, that is, the jar package is not packaged into the APK file.

Find the. classpath file in the android project and open it. The file code is as follows:

<?xml version="1.0" encoding="UTF-8"?><classpath>    <classpathentry kind="src" path="src"/>    <classpathentry kind="src" path="gen"/>    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>    <classpathentry kind="lib" path="E:/Code/android/Lib/MapApi.jar"/>    <classpathentry kind="lib" path="E:/Code/android/Lib/xpp3_min-1.1.4c.jar"/>    <classpathentry kind="lib" path="E:/Code/android/Lib/xstream-for-android-1.0.0.jar"/>    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>    <classpathentry kind="output" path="bin/classes"/></classpath>

The following row contains exported

 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>

If you want to add it in Lib, modify it as follows:

<?xml version="1.0" encoding="UTF-8"?><classpath>    <classpathentry kind="src" path="src"/>    <classpathentry kind="src" path="gen"/>    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>    <classpathentry exported="true" kind="lib" path="E:/Code/android/Lib/MapApi.jar"/>    <classpathentry exported="true" kind="lib" path="E:/Code/android/Lib/xpp3_min-1.1.4c.jar"/>    <classpathentry exported="true" kind="lib" path="E:/Code/android/Lib/xstream-for-android-1.0.0.jar"/>    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>    <classpathentry kind="output" path="bin/classes"/></classpath>

During packaging, the file becomes larger. Haha, the file should be packed in.

After testing, it is successful, but the next step is to know how to set it in eclipse.

Related Article

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.