How to merge the functions of two projects in Android

Source: Internet
Author: User


Today, for some reason, to receive a task, we need to merge two versions originally released in the form of two APK packages. Because of their complementary functions, we hope to merge these two projects into one project. After carefully sorting out the ideas, I decided to integrate an APK package close to the underlying service into a jar package!

I thought I had to manually export the jar and then reference it. Later I found that eclipse already has this function, as long as we directly reference it in the function properties. Project-> properties-> Android, there is a library option in the lower right corner. We only need to add the project we want to include. Here, of course, IDE will only prompt the names of the projects that serve as libraries, so we need to do a little work on another project. is to set it to library. the specific method is the path project-> properties-> Android, but this time we need to check it in the is library, this project will be considered to be provided as a library! Well, the basic combination framework has been completed. The following describes how to integrate the content. Because the two projects are originally independent APK, therefore, it will contain their respective resource files and some project-related files. Here we only need. the content in XML can be transplanted. Program Related part Declaration, we need to integrate it into our target project, the specific practice is of course only copy, modify. I believe you understand this: At last, the manifest shown in the manifest file in the library will have only this box left: <? XML version = "1.0" encoding = "UTF-8"?> <Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" Package = "com. avtest"> <Application/> </Manifest> In this way, our project will be completed: the pipeline image, then its approach is to find that this situation is dominated by the target project, directly ignoring the resource file in the library. Therefore, we recommend that you set a set of rules for naming these resources during library development to prevent duplicate names! The last small problem I encountered was that when I signed the final APK package, many. xml files reported Not well-formed (invalid token) The error, this problem also plagued for a period of time, although I know it should be a problem of file format, but when I set the character encoding of the two projects to UTF-8 still can not, the last step is to set it in WINDOW> preference> workspace> text file encodeing. Finally, we are done!
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.