Resource usage issues after Android export jar package

Source: Internet
Author: User

Resource usage issues with Android export jar Package-mengweiqi33 column-Blog channel-csdn.net

We often meet the need to give others the use of our project, in order to be able to block the code, the code is packaged into a jar package for use by third parties, but how can our resource files be used for each other?

Online There are many ways, useful ClassLoader, have written dead ID, such as my another article

[HTML]View Plaincopyprint?
    1. http://blog.csdn.net/mengweiqi33/article/details/19902799
http://blog.csdn.net/mengweiqi33/article/details/19902799

In fact, it's not so complicated, let's introduce the specific method

First, set the project you want to encapsulate the jar package as a library file

Right-click the item name--properties--the checkbox you checked.

Second, the most critical step, clean a project!!!

Eclipse Click on the project--clean--on the toolbar above to select the project to determine

three, using Eclipse's export function, the source code (note is only the SRC directory source code, if necessary can also add assets directory, other resources we will be in the form of a library project to the user) Export the jar package and place the jar package in the original project's Libs directory and refresh.  

Here I would add an explanation, the exported jar at this time, the inside of theObject = Findviewbyid(R.id.id_name)The R.id.id_name and other parts, is not changed, if you did not do the first step and the second step to export directly, thenThe R.id.id_name section becomes the ID value in the R file, such as:Object = Findviewbyid(2114243567).



Iv.



V. Add the Srcjar.jar package to the customer's project (we simply simulate the Jardemo project) and introduce our plugin resource pool project (note that the customer project must be in the same directory as the resource Project ) .  



Six. Add the content from the androidmanifest.xml of the plugin repository project to the customer project and you are done!  

Note: If there is a call to the project directory in your project called resources, such as assets apk or MP3 files, can be copied to the corresponding directory of the client.  



If this method doesn't work, refer to another blog post

[HTML]View Plaincopyprint?
    1. http://blog.csdn.net/mengweiqi33/article/details/19902799

Resource usage issues after Android export jar package

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.