Introduction
During development, there are usually multiple projectsCodeIn this case, the common practice is to set project dependencies so that one project can reference another project, for example, in Visual Studio.
In the android project of Eclipse, If You Want To reference another project, a similar method should be used theoretically:
Here is a reference project named core.
In this case, no problem occurs during code writing, but the noclassdeffounderror exception occurs when running the simulator because the class in the referenced project cannot be found.
In this window, you can add references using various functions in the libraries tab. The result is usually either compilation failure or the same as above.
I searched the internet for a long time and found that many people encountered this problem ~
Create a JAR File
It seems that eclipse cannot automatically implement project integration. Therefore, you can only consider outputting public projects as jar before importing the required projects.
Because my public project is not a general Android project, I only want it to act as a public class library and provide some general functions, therefore, I created this project as a common Java project, removed the Java-se reference from libraries, and added android. jar. JAR file), and then execute export:
Select the JAR file type:
Next, set the Save path here:
Next, go to the next step. Here you can use the default settings to generate the manifest file, or you can set the specified file by yourself:
The export is complete.
Import jar files
Now you need to import the previously exported JAR file in the project to be used. You only need to add external jars... Function select the previously exported JAR file:
References
Http://blog.csdn.net/guanmjie/archive/2009/08/12/4437779.aspx
Http://hi.baidu.com/gaogaf/blog/item/1757d309274b098cd1581bd7.html