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?
- 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?
- http://blog.csdn.net/mengweiqi33/article/details/19902799